Docinfo Extension Example

Purpose

Add the sentence "Made with <3" in the footer.

sample-love-doc.adoc

= Title

== First section

This is a paragraph.

LoveFooterDocinfoProcessor

love-footer-docinfo-processor.js
module.exports = function (registry) {
  registry.docinfoProcessor(function () {
    var self = this
    self.atLocation('footer')
    self.process(function () {
      return 'Made with <3'
    })
  })
}

Usage

const asciidoctor = require('asciidoctor')()
const registry = asciidoctor.Extensions.create()
require('./love-footer-docinfo-processor.js')(registry)

const html = asciidoctor.convertFile('sample-love-doc.adoc', { 'to_file': false, 'extension_registry': registry })
console.log(html)