Skip to content

Releases: asciidoctor/asciidoctor.js

v1.5.7-rc.1

08 Jul 11:41
Compare
Choose a tag to compare
v1.5.7-rc.1 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.7.1 and Opal 0.11.1.dev (3c8d93e).

Changelog

Breaking changes

  • Asciidoctor.js now requires Node 8.11+ and npm 5+

Bug fixes

Improvements

  • Update to Opal 0.11.1.dev@3c8d93e (#511)
  • 🎉 Opal now uses Object.defineProperty for methods and props opal/opal#1821. It should fix infinite loop when using for (let prop in obj) on Opal objects
  • Experimental Extension API: Allow class and class instance to be registered as (#412)
// Create an include processor class called StaticIncludeProcessor
const registry = asciidoctor.Extensions.create();
registry.includeProcessor(asciidoctor.Extensions.createIncludeProcessor('StaticIncludeProcessor', {
  process: (doc, reader, target, attrs) => {
    reader.pushInclude(['included content'], target, target, 1, attrs);
  }
}));
// Also available:
// - asciidoctor.Extensions.createDocinfoProcessor
// - asciidoctor.Extensions.createBlockProcessor
// - asciidoctor.Extensions.createInlineMacroProcessor
// - asciidoctor.Extensions.createBlockMacroProcessor
// - asciidoctor.Extensions.createTreeProcessor
// - asciidoctor.Extensions.createPreprocessor
// - asciidoctor.Extensions.createPostprocessor
// Create and instantiate an include processor class called StaticIncludeProcessor
const registry = asciidoctor.Extensions.create();
registry.includeProcessor(asciidoctor.Extensions.newIncludeProcessor('StaticIncludeProcessor', {
  process: function (doc, reader, target, attrs) {
    reader.pushInclude(['included content'], target, target, 1, attrs);
  }
}));
// Also available:
// - asciidoctor.Extensions.newDocinfoProcessor
// - asciidoctor.Extensions.newBlockProcessor
// - asciidoctor.Extensions.newInlineMacroProcessor
// - asciidoctor.Extensions.newBlockMacroProcessor
// - asciidoctor.Extensions.newTreeProcessor
// - asciidoctor.Extensions.newPreprocessor
// - asciidoctor.Extensions.newPostprocessor
// Create an include processor class with:
// - an overloaded constructor "initialize" to store the variable "value"
// - a "postConstruct" function to define the variable "bar" once the processor has been instantiated
const registry = asciidoctor.Extensions.create();
let includeProcessor = asciidoctor.Extensions.createIncludeProcessor('StaticIncludeProcessor', {
  initialize: function (value) {
    this.value = value;
    this.super();
  },
  postConstruct: function () {
    this.bar = 'bar';
  },
  process: function (doc, reader, target, attrs) {
    // In this example, this.value equals "foo" and this.bar equals "bar"
    reader.pushInclude([this.value + this.bar], target, target, 1, attrs);
  }
});
let includeProcessorInstance = includeProcessor.$new('foo'); // "initialize" function will be called with value "foo"
registry.includeProcessor(includeProcessorInstance);

📖 API documentation

Infrastructure

  • The tests suite has been restructured to be faster and easier to debug (#506)
    • npm run test:node will run the tests suite against Node.js
    • npm run test:browser will run the tests suite against Chrome
    • npm run test:nashorn will run the tests suite against Nashorn
  • Add jsDeliver badge on the README (#509)
  • cdnjs now contains the latest version of Asciidoctor.js: https://cdnjs.com/libraries/asciidoctor.js/1.5.7-beta.1

Release Meta

Released on: 2018-07-08
Released by: @Mogztter
Published by: Travis

v1.5.7-beta.1

10 May 14:17
Compare
Choose a tag to compare
v1.5.7-beta.1 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.7.1 and Opal 0.11.1.dev (3d856c4).

Changelog

Breaking changes

  • Attributes passed to process method of an extension are now converted to JavaScript object (#477)
registry.inlineMacro(function () {
  const self = this;
  self.named('emoji');

  self.process(function (parent, target, attrs) {
    // const sizeAttr = attrs['$[]']('size');
    const sizeAttr = attrs.size;
  });
});

NOTE: If you are using IE11, you will need to add a polyfill on Proxy.

Bug fixes

  • Escaped pipes are now interpreted in tables (#482) thanks @mlind
|===
|`-a\|-b`|Options cannot be used together
|===

Improvements

  • Update to Opal 0.11.1.dev@3d856c4 (#486)
  • ⚡ Performance improvement up to 10% thanks to the Regex cache in Opal
  • Core API: Map Section getters and setters methods (#500)
const source = `= Title

== First section`;
const doc = asciidoctor.load(source);
console.log(doc.hasSections()); // true
console.log(doc.getSections().length); // 1
const firstSection = doc.getSections()[0];
console.log(firstSection.getIndex()); // 0
console.log(firstSection.getTitle()); // First section
console.log(firstSection.getSectionName()); // section
// ...
  • Extension API: Add a prepend function to prepend document extension (#492)
registry.preprocessor(function () {
  const self = this;
  self.prepend();
  self.process(function (doc, reader) {
    // ...
  });
});

📖 API documentation

Infrastructure

  • Run the examples task on AppVeyor (#495)
  • Upgrade dev dependencies
    • asciidoctor-docbook.js to 1.5.6-rc1 (#488)
    • puppeteer to 1.3.0 (#487)
    • bestikk-uglify to 0.2.2 (#496)
    • documentation to 6.3.2 (#497)
    • eslint to 4.19.1 (#498)
    • ... (#498)
  • Build against Asciidoctor (core) 1.5.7.1

Release Meta

Released on: 2018-05-10
Released by: @Mogztter
Published by: @Mogztter

v1.5.6

17 Apr 14:03
Compare
Choose a tag to compare

This release is based on Asciidoctor 1.5.6.2 and Opal 0.11.1.dev (ceda559).

As a reminder, Asciidoctor.js now provides different builds for different JS environments:

Environment File
Browser dist/browser/asciidoctor.js
Node/Electron dist/node/asciidoctor.js
Nashorn dist/nashorn/asciidoctor.js
UMD dist/umd/asciidoctor.js

For backward compatibility, dist/asciidoctor.js and dist/asciidoctor.min.js are still available.

Changelog

Includes everything from 1.5.6-rc.1 and more!

Bug fixes

  • Fix failure when retrieving extension groups when none have been defined (#434)
  • Fix Extensions#unregister when names are passed as array (#469)

Improvements

  • Include directive is now working on http and https URI in a Node.js environment (#472)
const opts = {
  safe: 'safe',
  attributes: {'allow-uri-read': true}
};
const html = asciidoctor.convert('include::https://raw.com/document.adoc[tag=intro]', opts);
  • Update to Opal 0.11.1.dev@ceda559 (#472)
  • Return undefined if the subtitle is Opal.nil (#473)
  • Core API: Map AbstractNode#getParent (#461)
const doc = asciidoctor.load('= Document Title\n\ncontent', options);
console.log(doc.getParent()); // undefined
console.log(doc.getBlocks()[0].getParent()) // the parent doc
  • Core API: Map substitution methods on AbstractBlock (#462)
const source = '----\nverbatim <1>\n----\n<1> verbatim text';
const listingBlock = asciidoctor.load(source).findBy({ context: 'listing' })[0];

// getSubstitutions
console.log(listingBlock.getSubstitutions()); // ['specialcharacters', 'callouts']

// hasSubstitution
console.log(listingBlock.hasSubstitution('callouts')); // true
console.log(listingBlock.hasSubstitution('macros')); // false

// removeSubstitution
listingBlock.removeSubstitution('callouts'); 
console.log(listingBlock.hasSubstitution('callouts')); // false
const source = '----\nverbatim <1>\n----\n<1> verbatim text';
const listingBlock = asciidoctor.load(source).findBy({ context: 'listing' })[0];
console.log(listingBlock.getSubstitutions()); // ['specialcharacters', 'callouts']
  • Extension API: Map method to register block on multiple contexts (#465)
asciidoctor.Extensions.register(function () {
  this.block(function () {
    this.named('cloak');
    this.onContexts('paragraph', 'literal');
    this.process((parent, reader, attrs) => {
      return this.createBlock(parent, 'paragraph', 'cloaked: ' + Opal.hash_get(attrs, 'cloaked-context'));
    });
  });
});

📖 API documentation

Release Meta

Released on: 2018-04-17
Released by: @Mogztter
Published by: Travis!

v1.5.6-rc.1

22 Mar 19:56
Compare
Choose a tag to compare
v1.5.6-rc.1 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.6.2 and Opal 0.11.1.dev (fc20415).

The most notable improvement in this release is that the logic for resolving the path of an include directive is now overridden in Asciidoctor.js in order to properly resolve the path of an include directive in the browser environment.

We're also happy to report that Asciidoctor.js now provides different builds for different JS environments:

Environment File
Browser dist/browser/asciidoctor.js
Node/Electron dist/node/asciidoctor.js
Nashorn dist/nashorn/asciidoctor.js
UMD dist/umd/asciidoctor.js

For backward compatibility, dist/asciidoctor.js and dist/asciidoctor.min.js are still available.

Next stop 1.5.6 🎉

Changelog

Bug fixes

  • Preserve read error reason in File.read (#434)
  • AbstractNode.isAttribute now returns true or false (#432)
  • AbstractBlock.getTitle now returns undefined if the title is not set (#429)

Improvements

  • Upgrade to Opal 0.11.1.dev@fc20415 (#384)
  • Properly resolve the path of an include directive in the browser environment (#441)
  • Use escape code in regular expressions instead of raw glyphs (#395)
  • Allow class or class instance to be registered as an extension (#453)
  • Core API: Add AbstractNode.hasAttribute (#431)
doc.hasAttribute('sectnums'); // true or false
  • Core API: Add Reader.getString (#443)
const doc = asciidoctor.load('line one\nline two\nline three', { parse: false });
console.log(doc.getReader().getString()); // line one\nline two\nline three
  • Core API: Retrieve a converter instance from the converter factory (#451)
const converter = asciidoctor.Converter.Factory.getDefault(false).create('html5');
const para = asciidoctor.load('text').getBlocks()[0];
console.log(converter.convert(para)); // <p>text</p>
  • Extension API: Add Processor.createImageBlock (#442)
this.blockMacro(function () {
  this.named('img');
  this.process((parent, target) => {
    return this.createImageBlock(parent, { target: target + '.png' });
  });
});
  • Extension API: Add Extensions.getGroups, Extensions.unregisterAll and Extensions.unregister (also available on a Registry) (#450)
const registry = asciidoctor.Extensions.create();
// ...
const groups = registry.getGroups();
registry.unregister('test');
registry.unregisterAll();

📖 API documentation

Infrastructure

  • Provide each implementation as a file (#425)
  • Add a build:quick task for a fast feedback loop while coding on the API (#449)
  • Allow ASCIIDOCTOR_CORE_VERSION to reference a fork (#439)
ASCIIDOCTOR_CORE_VERSION=mojavelinux/asciidoctor#v1.5.6.x
  • Refactor benchmark scripts (#421)
  • Update link to opalrb website in the README (#422). Thanks @1602
  • Upgrade development dependencies (#419, #414, #415, #416, #417)
  • Use yarn to speed up build on CI (#418)

Release Meta

Released on: 2018-03-22
Released by: @Mogztter
Published by: Travis!

v1.5.6-preview.5

28 Jan 17:40
Compare
Choose a tag to compare
v1.5.6-preview.5 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.6.1 and Opal 0.11.0.dev (integration).

Changelog

Bug fixes

  • ReferenceError: "plaform" is not defined with Nashorn (#390). Thanks @jmini

Improvements

  • Implement Dir.pwd in Nashorn (#392)
  • Add a stub to support URI (#398)
  • Core API: Add List.getItems and ListItem.getText (#401). Thanks @mojavelinux
  • Core API: Add Block.getSourceLines and Block.getSource (#402). Thanks @mojavelinux
  • Core API: Set document title and title to undefined if not set (#403). Thanks @mojavelinux

📖 API documentation

Infrastructure

  • Convert README to Markdown before publishing package to npmjs (#411). Thanks @mojavelinux

Release Meta

Released on: 2017-01-28
Released by: @Mogztter
Published by: Travis!

v1.5.6-preview.4

08 Oct 11:36
Compare
Choose a tag to compare
v1.5.6-preview.4 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.6.1 and Opal 0.11.0.dev (integration).

Changelog

Bug fixes

  • Processor fails to convert document containing a certain sequence of characters (#367). Thanks @mojavelinux
  • Document.getBaseDir always returns "undefined" (#380)
  • Opal.const_get_qualified does not resolve ThreadSafe.Cache (#370)

Improvements

  • Core API: Add AbstractBlock.getCaptionedTitle (#349)
const doc = asciidoctor.load(`= The Dangerous Documentation Chronicles: Based on True Events
:title: The Actual Dangerous Documentation Chronicles`);
console.log(doc.getCaptionedTitle()); // The Actual Dangerous Documentation Chronicles
  • Core API: Add Asciidoctor.getCoreVersion (#362)
const version = asciidoctor.getCoreVersion(); // Asciidoctor core (Ruby) version
  • Core API: Add Asciidoctor.getVersion (#362)
const version = asciidoctor.getVersion(); // Asciidoctor.js version
  • Extensions API: Add Extensions.unregisterAll to unregister all statically-registered extension groups
  • Move xmlhttprequest as a dev dependency (#387)

📖 API documentation

Release Meta

Released on: 2017-10-08
Released by: @Mogztter
Published by: Travis!

v1.5.5

08 Oct 09:02
Compare
Choose a tag to compare

This release is based on Asciidoctor 1.5.5 and Opal 0.11.0.dev (integration).

Changelog

Includes everything from 1.5.5-5 and more!

Improvements

Release Meta

Released on: 2017-10-08
Released by: @Mogztter
Published by: Travis!

v1.5.6-preview.3

24 Jul 14:30
Compare
Choose a tag to compare
v1.5.6-preview.3 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.6.1 and Opal 0.11.0.dev (integration).

Changelog

Improvements

  • Upgrade to Asciidoctor 1.5.6.1
  • Core API: Add Document.getCatalog API (#349)
const doc = asciidoctor.load('link:index.html[Docs]', {'safe': 'safe', 'catalog_assets': true});
doc.convert();
const links = doc.getCatalog().links; // ['index.html']

📖 API documentation

Release Meta

Released on: 2017-07-24
Released by: @Mogztter
Published by: Travis!

v1.5.6-preview.2

20 Jun 19:04
Compare
Choose a tag to compare
v1.5.6-preview.2 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.6.dev (master) and Opal 0.11.0.dev (integration).

Changelog

Improvements

Release Meta

Released on: 2017-06-20
Released by: @Mogztter

v1.5.6-preview.1

03 Apr 17:06
Compare
Choose a tag to compare
v1.5.6-preview.1 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.6.dev (master) and Opal 0.11.0.dev (integration).

Changelog

Improvements

  • Upgrade to Asciidoctor 1.5.6.dev (master)

Release Meta

Released on: 2017-04-03
Released by: @Mogztter