Skip to content

Latest commit

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Transforms KDL to HTML according to this spec. Also supports:

  • Markdown nodes
  • Include files (HTML, KDL, markdown)
  • String interpolation
  • Set variables with the CLI or with an envfile

Sample

navbar.kdl:

nav {
 ahref="index.html""Home" ahref="about.html""About"
}

news.md:

# News
Nothing going on!

template.kdl:

!doctype"html"htmllang="en" {
 head {
 metacharset="utf-8" title"${TITLE} - AwesomeSite" linkhref="/style.css"rel="stylesheet"
}
 body {
 divclass="container" {
 header {
 divclass="logo" {
 imgsrc="logo.png" span"AwesomeSite"
}
}
 @include"navbar.kdl" main {
 markdown {
"Welcome to AwesomeSite, the _craziest_ site""on the entire 'net since ${YEAR}!"
}
 @include"news.md"
}
 footer"© ${YEAR} AwesomeSite"
}
}
}

Comile the page like this:

$ kdl2html template.kdl --bind "TITLE=home" --bind "YEAR=1999"

Here's what comes out:

<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8" /><title>Home - AwesomeSite</title><linkhref="/style.css" rel="stylesheet" /></head><body><divclass="container"><header><divclass="logo"><imgsrc="logo.png" /><span>AwesomeSite</span></div></header><nav><ahref="index.html">Home</a><ahref="about.html">About</a></nav><main><p>Welcome to AwesomeSite, the <em>craziest</em> site
on the entire 'net since 1999!</p><h1>News</h1><p>Nothing going on!</p></main><footer>© 1999 AwesomeSite</footer></div></body></html>

About

Write your HTML in KDL, with markdown, variable interpolation, and includes

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages