Skip to content

Releases: asciidoctor/asciidoctor.js

v1.5.5-5

03 Apr 17:01
Compare
Choose a tag to compare
v1.5.5-5 Pre-release
Pre-release

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

Changelog

Includes everything from 1.5.5-4 and more!

Breaking changes

  • Change casing of URI to Uri in functions
// Before
// doc.getIconURI('note');
// doc.getMediaURI('target');
// doc.getImageURI('target.jpg');

// After
doc.getIconUri('note');
doc.getMediaUri('target');
doc.getImageUri('target.jpg');
  • Core API: getAttributes function now returns a JSON object (rather than an Opal.hash)
// Before
// var author = doc.getAttributes()['$[]']('author');

// After
var author = doc.getAttributes()['author'];

Improvements

  • Upgrade to Opal 0.11.0.dev (integration)
  • Core API: Attributes can now be defined in JSON format
// Before
// var options = { attributes: [ 'icons=font', 'sectnums=true' ] };

// After
var options = { attributes: { icons: 'font', sectnums: true } };
var doc = asciidoctor.load('= Test', options);
  • Core API: Add alias getDocumentTitle to getDoctitle function
  • Core API: Add alias getRevisionDate to getRevdate function
  • Core API: Asciidoctor.convert and Asciidoctor.load functions can be used with a Node.js Buffer
// load from a Buffer
var doc = asciidoctor.load(fs.readFileSync('test.adoc'));
// convert from a Buffer
var html = asciidoctor.convert(fs.readFileSync('test.adoc'));
  • Core API: findBy method
var doc = asciidoctor.loadFile('document.adoc');
// Using a function
var quoteBlocks = doc.findBy(function (b) { return b.getStyle() === 'quote'; });
// Using a selector
var sectionBlocks = doc.findBy({'context': 'section'});
// Using both a selector and a function
var abstractSectionBlocks = doc.findBy({'context': 'section'}, function (b) { return b.getTitle() === 'Second Section'; });
  • Extensions API: register a block extension
Opal.Asciidoctor.$$scope.Extensions.register(function () {
  this.block(function () {
    var self = this;
    self.named('shout');
    self.onContext('paragraph');
    self.process(function (parent, reader) {
      var lines = reader.$lines().map(function (l) { return l.toUpperCase(); });
      return self.createBlock(parent, 'paragraph', lines);
    });
  });
});
  • Extensions API: register an inline macro
Opal.Asciidoctor.$$scope.Extensions.register(function () {
  this.inlineMacro('smiley', function () {
    var self = this;
    self.process(function (parent, target) {
      var text;
      if (target == 'happy') {
        text = ':D';
      } else if (target == 'wink') {
        text = ';)';
      } else {
        text = ':)';
      }
      return self.createInline(parent, 'quoted', text, { 'type': 'strong' }).convert();
    }); 
  });
});

Infrastructure

  • Allow to skip to clean task with SKIP_CLEAN environment variable
  • Build against Asciidoctor core master
    • Allow to build against a specific release with ASCIIDOCTOR_CORE_VERSION environment variable

Release Meta

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

v1.5.5-4

19 Nov 21:12
Compare
Choose a tag to compare
v1.5.5-4 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.5 and Opal 0.10.1.

Changelog

Includes everything from 1.5.5-3 and more!

Breaking changes

  • Dobook backend has been moved to a dedicated repository and is no longer bundled with Asciidoctor.js core.
  • Extensions has been moved to the extensions directory in the dist folder.
  • Asciidoctor.js now includes extensions API by default and Opal will be automatically loaded. (meaning the asciidoctor.js file includes everything you need!)
  • Asciidoctor.js is now available as a Universal Module Definition
  • Asciidoctor.js runtime environment can be configured.

As a result the instantiation of Asciidoctor.js is now consistent across JavaScript environments:

  • Browser
">
<script src="node_modules/asciidoctor.js/dist/asciidoctor.min.js"></script>
var asciidoctor = Asciidoctor(); // available in the global scope
var content = '...';
var html = asciidoctor.convert(content);
console.log(html);
  • Node
var Asciidoctor = require('asciidoctor.js');
var asciidoctor = Asciidoctor(); 
var content = '...';
var html = asciidoctor.convert(content);
console.log(html); 
  • Require.js (AMD)
">
<script data-main="scripts/main" src="scripts/require.js"></script>
define(['asciidoctor'], function(asciidoctor) {
  var content = '...';
  var html = asciidoctor.convert(content);
  console.log(html);
});

Infrastructure

  • Adds a Karma runner for Require.js

Release Meta

Released on: 2016-11-19
Released by: @Mogztter

v1.5.5-3

29 Oct 21:19
Compare
Choose a tag to compare
v1.5.5-3 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.5 and Opal 0.10.1.

Changelog

Includes everything from 1.5.5-2 and more!

Improvements

  • Upgrade to Opal 0.10.1
  • Upgrade to Asciidoctor 1.5.5
  • Create a wrapper API
// Plain JSON object for options
var options = {safe: 'unsafe', attributes: ['showtitle', 'stylesheet=custom.css']};

// Method names are camel case (and without dollar sign)
var doc = Asciidoctor.load(content, options);
var footnotes = doc.getFootnotes();
var doctype = doc.getDoctype();
var lang = doc.getAttribute('lang');
var html = doc.convert();
  • New features on Node.js
    • Automatically load Opal's nodejs and pathname modules. You no longer have to manually call Opal.load('nodejs') and Opal.load('pathname') when running on Node.js
    • Improve the path resolution of the default stylesheet
  • Initial support for template backends

Infrastructure

Release Meta

Released on: 2016-10-22
Released by: @Mogztter

v1.5.5-2

24 Aug 18:24
Compare
Choose a tag to compare
v1.5.5-2 Pre-release
Pre-release

This release is based on Asciidoctor 1.5.4 and Opal 0.10.1.

Changelog

Breaking changes

Opal 0.9 renamed the following properties on Hash object (#152):

  • keys to $$keys
  • map to $$map
  • smap to $$smap

As mentioned in the Asciidoctor.js 1.5.3 changelog, you should not use Opal's internal properties.
Instead you should $attr method (available in the Asciidoctor public API):

var doc = Asciidoctor.$load('== Test');
// var value = doc.attributes.smap['doctitle'];
var value = doc.$attr('doctitle');

Improvements

  • Upgrade to Opal 0.10.1
  • Compile Asciidoctor LaTex to JavaScript
  • New features on Node.js
    • Asciidoctor.$load_file and Asciidoctor.$convert_file methods are working
    • stylesheet and stylesdir attributes are supported
    • to_dir and to_file options are supported

Infrastructure

  • Compile Asciidoctor to JavaScript in JavaScript (ie. Ruby/Rake/Bundler are no longer needed to build Asciidoctor.js)
    • Asciidoctor.js build is now only using npm:
npm install
npm run build

Release Meta

Released on: 2016-08-24
Released by: @Mogztter

v1.5.4

31 Jan 14:23
Compare
Choose a tag to compare

This release is based on Asciidoctor 1.5.4 and Opal 0.9.0.beta2.

Changelog

Improvements

  • Manual require has been removed
  • Extensions are now automatically required (Opal.require is no longer necessary)
  • Gzip version of Asciidoctor.js are not included in the dist folder
  • Made some progress on Node.js IO (hopefully includes from URI will soon be available in Node.js environment)

Infrastructure

  • Fully automated release with npm (toward a 100% JavaScript build!)
    • Switch to npm (task runner) and remove Grunt for the build
    • Reduce the # of development dependencies
    • Rewrite Rake tasks in JavaScript
  • Replace Uglify by Google Closure Compiler to minify JavaScript

Release Meta

Released on: 2016-01-31
Released by: @Mogztter

v1.5.3

09 Jan 12:05
Compare
Choose a tag to compare

This release is based on Asciidoctor 1.5.3 and Opal 0.9.0.beta2.

Changelog

Breaking changes

Opal 0.8 renames map to smap on Hash object.
map and smap are Opal's internal properties and you should use Hash.fetch method instead:

// var value = attributes.map['doctitle']
var value = attributes.$fetch['doctitle'];
var value = attributes['$[]']('doctitle'); // alternative syntax

Improvements

  • Simpler syntax to declare Asciidoctor options with Opal.hash

    // var options = Opal.hash2(['doctype', 'attributes'], {doctype: 'inline', attributes: ['showtitle']});
    var options = Opal.hash({doctype: 'inline', attributes: ['showtitle']});
  • Remove Opal overrides/extensions from Asciidoctor.js (now directly integrated in Opal)

Release Meta

Released on: 2016-01-07
Released by: @Mogztter

v1.5.2

08 Oct 17:05
Compare
Choose a tag to compare
Update version in bower.json and package.json

v1.5.1

09 Nov 23:00
Compare
Choose a tag to compare
Upgrade bower.json and package.json to 1.5.1

v1.5.0

01 Sep 17:32
Compare
Choose a tag to compare
Merge pull request #49 from anthonny/docbook-backend

Docbook backend

v1.5.0 Preview 7

18 May 02:09
Compare
Choose a tag to compare
v1.5.0 Preview 7 Pre-release
Pre-release
  • Upgrade to Opal 0.6.2 and Asciidoctor 1.5.0.preview.7
  • Remove ERB converter templates in favor of built-in converter
  • Enable includes
  • Add hack to make version compliant with semantic versioning
  • Fix numerous regular expression compatibility bugs