Allow playbook to enable sourcemap option on AsciiDoc processor
The sourcemap option on the AsciiDoc processor (Asciidoctor) enables line and file tracking on source blocks. It's not enabled by default because it adds additional processing and object allocation to the build process. So enabling it is a decision left up to the user.
There are two use cases for wanting to enable this option. First, an Asciidoctor extension may rely on this information being set, and thus the extension author may request that the user enable this option when calling Asciidoctor. So we need to give the user the ability to do so. Enabling this setting can also make certain log messages more informative. For example, when enabled, the error message about an unresolved xref (see #403 (closed)) could be automatically enhanced to include the file and line number (tying into the existing logger adapter between Asciidoctor and Antora).
The option would be specified in the playbook as follows:
asciidoc:
sourcemap: true
This should be mapped to the boolean CLI option --sourcemap. (or --asciidoc-sourcemap?)
Technically, it's already possible to enable this option using the following Asciidoctor extension:
module.exports = {
register (registry) {
registry.preprocessor(function () {
this.process((doc) => {
doc.sourcemap = true
})
})
}
}
This extension then must be registered in the playbook as follows:
asciidoc:
extensions:
- ./enable-sourcemap.js
However, it's rather clear that being able to specify this using a key in the playbook is a much more pleasant experience for the user.