Docinfo Extension Example
- Purpose
-
Add the sentence "Made with <3" in the footer.
LoveFooterDocinfoProcessor
love-footer-docinfo-processor.js
export default function (registry) {
registry.docinfoProcessor(function () {
const self = this
self.atLocation('footer')
self.process(function () {
return 'Made with <3'
})
})
}
Usage
import { Extensions, convertFile } from '@asciidoctor/core'
import registerLoveFooterDocinfoProcessor from './love-footer-docinfo-processor.js'
const registry = Extensions.create()
registerLoveFooterDocinfoProcessor(registry)
const html = await convertFile('sample-love-doc.adoc', { to_file: false, extension_registry: registry })
console.log(html)