ibra
v1.0.3
Published
Use markdown as an html templating engine.
Downloads
6
Maintainers
Readme
Ibra
Install
npm i ibra --save
Ibra is a performant templating engine for javascript that uses markdown syntax to define structure. Lodash style templates can be used to process logic in your markdown files. Essentially, mix markdown syntax and lodash templating for rendering HTML.
For information on using lodash templates visit the lodash documentation
Usage
Use @{
and @}
for defining blocks that should be evaluated as lodash templates.
const text = `# @{
<%=name %>
@}
@{
<ul>
<% for (var i = 1; i <= 10; i++) { %>
<li><%=i%></li>
<% } %>
</ul>
@}`
const data = {name: 'tom'}
const ibra = require('ibra')
const html = ibra(content, data)
/*
html becomes:
<h1>tom</h1>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
...
</ul>'
*/
Contributing
Fork this repository and run npm install
in project directory.
Tests
npm run test