Releases: asciidoctor/asciidoctor.js
v1.5.7-rc.1
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
- Filter non numeric keys from getAttributes (#491) thanks @s-leroux
- Bypass IO.binread when reading include files in reader (#502) thanks @mojavelinux & @oncletom
- Add a test on a file with a BOM (#505)
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 usingfor (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);
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.jsnpm run test:browser
will run the tests suite against Chromenpm 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
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
|===
|`-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) {
// ...
});
});
Infrastructure
- Run the
examples
task on AppVeyor (#495) - Upgrade dev dependencies
- Build against Asciidoctor (core) 1.5.7.1
Release Meta
Released on: 2018-05-10
Released by: @Mogztter
Published by: @Mogztter
v1.5.6
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
andhttps
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 isOpal.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'));
});
});
});
Release Meta
Released on: 2018-04-17
Released by: @Mogztter
Published by: Travis!
v1.5.6-rc.1
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 returnsundefined
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
andExtensions.unregister
(also available on aRegistry
) (#450)
const registry = asciidoctor.Extensions.create();
// ...
const groups = registry.getGroups();
registry.unregister('test');
registry.unregisterAll();
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
This release is based on Asciidoctor 1.5.6.1 and Opal 0.11.0.dev (integration).
Changelog
Bug fixes
Improvements
- Implement
Dir.pwd
in Nashorn (#392) - Add a stub to support URI (#398)
- Core API: Add
List.getItems
andListItem.getText
(#401). Thanks @mojavelinux - Core API: Add
Block.getSourceLines
andBlock.getSource
(#402). Thanks @mojavelinux - Core API: Set document title and title to undefined if not set (#403). Thanks @mojavelinux
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
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 resolveThreadSafe.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)
Release Meta
Released on: 2017-10-08
Released by: @Mogztter
Published by: Travis!
v1.5.5
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
- Lot of new additions to the core and extension API, please read the Asciidoctor.js API documentation
Release Meta
Released on: 2017-10-08
Released by: @Mogztter
Published by: Travis!
v1.5.6-preview.3
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']
Release Meta
Released on: 2017-07-24
Released by: @Mogztter
Published by: Travis!
v1.5.6-preview.2
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)
- Lot of new additions to the core and extension API, please read the Asciidoctor.js API documentation
Release Meta
Released on: 2017-06-20
Released by: @Mogztter
v1.5.6-preview.1
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