Skip to content

v2.2.0

Compare
Choose a tag to compare
@github-actions github-actions released this 28 Apr 15:55

Summary

This release is based on Asciidoctor 2.0.10 and Opal 0.11.99.dev (31d26d69).

Highlights

The main feature highlight of the 2.2 release is the built-in template converter which supports out-of-the-box Pug, Nunjucks, EJS and Handlebars (optional dependency).
The quickest way to get started is to install one of the above template engine and to define a template directory. Here's a quick example on how to setup the template converter with Nunjucks:

install

$ npm i nunjucks

/path/to/templates/paragraph.njk

<p>{{ node.getContent() | safe }}</p>

convert.js

const options = { safe: 'safe', backend: 'html5', template_dir: '/path/to/templates' }
console.log(asciidoctor.convert('...', options))

Please note that we also provide all-in-one pack binaries that include the templates engines, so it's even easier to get started:

$ echo 'Hello *world*' | ./asciidoctor-linux -s -T ./templates -
<p>Hello <strong>world</strong></p>

If you want to learn more about the template converter, please read the documentation.

Release meta

Released on: 2020-04-28
Released by: @Mogztter
Published by: GitHub Actions

Logs: full diff

Changelog

Bug Fixes

  • asciidoctor command line installed from the package asciidoctor was throwing an exception (#849) - thanks @thorstenkampe
  • AbstractNode.hasSection now returns false for anything that isn’t itself a Section (#840) - thanks @henriette-einstein
  • Properly assign backend traits on converter instances (#904)
  • Bridge Converter.handles? method (#906)
  • Add or bridge the Converter.respond_to? method (#908)
  • Add or bridge the Converter.composed method (#907)
  • AbstractNode.getAttributes now returns undefined when the value is Opal.nil (#920)

Improvements

  • Upgrade @asciidoctor/cli in the asciidoctor package to 3.4.0 (#902)
  • Add a built-in template converter which supports out-of-the-box the following template engines (optional dependency):
    • Pug
    • Nunjucks
    • EJS
    • Handlebars
const options = { safe: 'safe', backend: 'html5', template_dir: '/path/to/templates' }
console.log(asciidoctor.convert('...', options))
  • Map Document.restoreAttributes (#843) (#851)
  • Map an internal API Document.playbackAttributes (#844) (#853)
  • Map Table, Column and Cell methods (#854) - many thanks to @henriette-einstein
  • Map Table.Cell.getInnerDocument (#901)
  • Map Substitutors.resolveSubstitutions, .resolveBlockSubstitutions and .resolvePassSubstitutions (#852)
  • Map ConverterFactory.getRegistry (#909)
class BlankConverter {
  convert () {
    return ''
  }
}
asciidoctor.ConverterFactory.register(new BlankConverter(), ['blank'])
const registry = asciidoctor.ConverterFactory.getRegistry()
registry.blank.convert()
  • Map ConverterFactory.for (#910)
const builtinHtml5Converter = asciidoctor.ConverterFactory.for('html5')
builtinHtml5Converter.convert()

asciidoctor.ConverterFactory.for('foo') // undefined

Infrastructure

  • Publish binaries of the asciidoctor CLI on GitHub releases (#929)
  • Update development dependencies
    • Bump libnpmpublish from 1.1.1 to 3.0.0 (#863)
    • Bump cross-env from 5.1.4 to 6.0.3 in /packages/core (#879)
    • Bump dtslint from 2.0.3 to 3.4.2 in /packages/core (#888) (#871) (#940)
    • Bump @types/node from 12.7.8 to 13.13.4 in /packages/core (#889) (#874) (#866) (#932) (#934) (#938) (#947)
    • Bump documentation from 12.1.3 to 12.1.4 in /packages/core (#882)
    • Bump sinon from 5.0.6 to 8.1.1 (#872)
    • Bump puppeteer from 1.18.0 to 3.0.1 in /packages/core (#876) (#931) (#939)
    • Bump eslint from 5.12.1 to 6.8.0 in /packages/core (#877)
    • Bump standard from 12.0.1 to 14.3.3 (#862)
    • Bump standard from 12.0.1 to 14.3.3 in /packages/core (#870)
    • Bump mocha from 6.1.4 to 7.1.2 in /packages/core (#864) (#946)
    • Bump mocha from 5.1.1 to 7.1.2 (#867) (#945)
    • Bump chai from 4.1.2 to 4.2.0 in /packages/core (#868)
    • Bump chai from 4.1.2 to 4.2.0 (#869)
    • Bump acorn from 5.7.3 to 5.7.4 in /packages/core (#860)
    • Bump acorn from 6.1.1 to 6.4.1 (#859)
    • Bump ejs from 3.0.1 to 3.0.2 in /packages/core (#922)
    • Bump pkg from 4.4.7 to 4.4.8 in /packages/asciidoctor (#948)
  • Add an explicit failure if the regular expression does not match in tests (#890)
  • Replace a Ruby example with a JavaScript example in the JSDoc (#856)
  • Increase tests timeout (#857)
  • Fix the test:graalvm task on macOS (#840)
  • Keep .dts directory to workaround an issue with npm/Travis (#842)
  • Test types against the built file (not the dist file) (#841)
  • Build on GitHub Actions (Windows) (#835)
  • Build the project on upstream changes (#839)
  • Fix newlines compatibility issues in tests (#838)
  • Add GitHub Actions badge (#836)
  • Run GitHub Actions on pull requests (#837)

📖 API documentation
📚 User Manual