* Update the trim nightmare * Update create-processor.js * Update other packages in the rendering pipeline * A few more updates * Fix tables * Update lint-files.js * Fix copy code blocks * Update render-content.js * remove whitespace from liquid conditionals * We no longer need require eslint rules * Neat, it worked * Revert test change * Update create-processor.js * Without aliases Co-authored-by: Chiedo John <2156688+chiedo@users.noreply.github.com> Co-authored-by: Rachael Sewell <rachmari@github.com>
Markdown and Liquid rendering pipeline.
Usage
const renderContent = require('.')
const html = await renderContent(`
# Beep
{{ foo }}
`, {
foo: 'bar'
})
Creates:
<h1 id="beep"><a href="#beep">Beep</a></h1>
<p>bar</p>
API
renderContent(markdown, context = {}, options = {})
Render a string of markdown with optional context. Returns a Promise.
Liquid will be looking for includes in ${process.cwd()}/includes.
Options:
encodeEntities: Encode html entities. Default:false.fileName: File name for debugging purposes.textOnly: Output text instead of html using cheerio.
.liquid
The Liquid instance used internally.
Code block headers
You can add a header to code blocks by adding the {:copy} annotation after the code fences:
```js{:copy}
const copyMe = true
```
This renders:
The un-highlighted text is available as button.js-btn-copy's data-clipboard-text attribute.
