snowpack-plugin-asciidoctor
v0.0.2
Published
Snowpack plugin to include and parse Asciidoctor files and convert them to .js
Downloads
2
Maintainers
Readme
Quick start
yarn add snowpack-plugin-asciidoctor --dev
Update your snowpack config:
// ./snowpack.config.json
{
"plugins": [
["snowpack-plugin-asciidoctor", { /* see "Plugin Options" below */ }],
]
}
// ./test.adoc
= My Asciidoctor File
:myVar: 'a value for my variable'
// ./your-file.js
import { doc } from './test.adoc'
console.log('Doc', doc)
// Prints (output)
{
filePath: '/home/your/test.adoc'
html: '<h1>My Asciidoctor File</h1>'
metadata: {
// asciidoctor document attributes https://asciidoctor.org/docs/user-manual/#attribute-catalog
// it contains also any attribute you declared in the asciidoctor file, e.g:
myVar: 'a value for my variable'
}
}
Plugin Options
Plugin options are passed directly to the Asciidoctor.js compiler. You can find the full attribute catalog at https://asciidoctor.org/docs/user-manual/#attribute-catalog.
Acknowledgements
- Inspired and guided by snowpack-plugin-mdsvex