A JavaScript port of Asciidoctor produced by Opal, a Ruby to JavaScript source-to-source compiler.
Mogztter Resolves #570 introduce DSL method to mark document processor as pr…
…eferred (#587)

* Resolves #570 introduce DSL method to mark document processor as preferred

* @deprecate the prepend function
Latest commit c286ad7 Nov 6, 2018
Permalink
Failed to load latest commit information.
antora/supplemental-ui Setup Antora and Netlify (#471) May 5, 2018
benchmark 📦 Provide each implementation as a file (#425) Mar 15, 2018
docs 📝 Resolves #561, Document how to use Asciidoctor.js with GraalVM (#566) Oct 26, 2018
examples ⬆️ Upgrade to Opal 0.11.1.dev@3c8d93e (#511) Jun 30, 2018
lib/asciidoctor 🎨 introduce CC_ANY character class (#504) Oct 30, 2018
netlify Setup Antora and Netlify (#471) May 5, 2018
npm 🎨 introduce CC_ANY character class (#504) Oct 30, 2018
scripts 🎨 Use npm instead of yarn in the package script Oct 30, 2018
spec Resolves #570 introduce DSL method to mark document processor as pr… Nov 6, 2018
src Resolves #570 introduce DSL method to mark document processor as pr… Nov 6, 2018
stdlib 🚑 Add logger impl to stdlib (#474) Apr 16, 2018
.editorconfig Create a wrapper API around Asciidoctor.js Oct 2, 2016
.eslintrc.js ♻️ Refactor the tests suite (#506) Jun 30, 2018
.gitignore Setup Antora and Netlify (#471) May 5, 2018
.travis-upstream-only.yml add upstream only matrix reference to Travis CI build (PR #366) Aug 13, 2017
.travis.yml 📌 Build on Asciidoctor 1.5.8 Oct 30, 2018
CONTRIBUTING-CODE.adoc 📝 Update contributing code guide Sep 22, 2018
CONTRIBUTING.adoc add an inspiring and welcoming intro to CONTRIBUTING.adoc Jul 4, 2015
LICENSE 🎊 Update copyright year Oct 30, 2018
README.adoc 📝 Add a direct link to the contributing code document Sep 29, 2018
appveyor.yml 👷 Replace async module with Promise in npm tasks (#560) Oct 15, 2018
error-in-chrome-console.png document how to debug errors using browser console Oct 22, 2013
error-in-javascript-debugger.png document how to debug errors using browser console Oct 22, 2013
netlify.toml Setup Antora and Netlify (#471) May 5, 2018
package-lock.json 1.5.7 Oct 30, 2018
package.json 1.5.7 Oct 30, 2018
site.yml 🚀 Antora is now on master May 5, 2018

README.adoc

Asciidoctor.js: AsciiDoc in JavaScript powered by Asciidoctor

Travis build status Appveyor build status npm version jsDelivr stats cdnjs JSDoc InchCI

Asciidoctor.js brings AsciiDoc to the JavaScript world!

This project uses Opal to transpile Asciidoctor, a modern implementation of AsciiDoc, from Ruby to JavaScript to produce asciidoctor.js. The asciidoctor.js script can be run on any JavaScript platform, including Node.js, Nashorn and, of course, a web browser.

Important
Asciidoctor.js does not use Semantic Versioning as the release versions are aligned on Asciidoctor (Ruby). It’s highly recommended to define the exact version in your package.json file (ie. without ^). Please read the release notes when upgrading to the latest version as breaking changes can be introduced in non major release.

Introduction

You can use Asciidoctor.js either for back-end development using Node.js or front-end development using a browser.

Front-end development

Installing Asciidoctor.js with npm
$ npm install asciidoctor.js --save

Once the package installed, you can add the following script tag to your HTML page:

<script src="node_modules/asciidoctor.js/dist/browser/asciidoctor.js"></script>

Here is a simple example that converts AsciiDoc to HTML5:

sample.js
var asciidoctor = Asciidoctor(); (1)
var content = "http://asciidoctor.org[*Asciidoctor*] " +
    "running on https://opalrb.com[_Opal_] " +
    "brings AsciiDoc to the browser!";
var html = asciidoctor.convert(content); (2)
console.log(html); (3)
  1. Instantiate the Asciidoctor.js library

  2. Convert AsciiDoc content to HTML5 using Asciidoctor.js

  3. Print the HTML5 output to the console

Back-end development

Installing Asciidoctor.js with npm
$ npm install asciidoctor.js --save

Once the package is installed, the first thing to do is to load the asciidoctor.js module using require, then you’re ready to start using the API:

sample.js
var asciidoctor = require('asciidoctor.js')(); (1)
var content = "http://asciidoctor.org[*Asciidoctor*] " +
    "running on https://opalrb.com[_Opal_] " +
    "brings AsciiDoc to Node.js!";
var html = asciidoctor.convert(content); (2)
console.log(html); (3)
  1. Instantiate the Asciidoctor.js library

  2. Convert AsciiDoc content to HTML5 using Asciidoctor.js

  3. Print the HTML5 output to the console

Save the file as sample.js and run it using the node command:

$ node sample.js

You should see the following output in your terminal:

<div class="paragraph">
<p><a href="http://asciidoctor.org"><strong>Asciidoctor</strong></a> running on <a href="http://opalrb.com"><em>Opal</em></a> brings AsciiDoc to Node.js!</p>
</div>

Advanced topics

If you want to know more about Asciidoctor.js, please read the User Manual.

Contributing

In the spirit of free software, everyone is encouraged to help improve this project. If you discover errors or omissions in the source code, documentation, or website content, please don’t hesitate to submit an issue or open a pull request with a fix. New contributors are always welcome!

The Contributing guide provides information on how to contribute.

If you want to write code, the Contributing Code guide will help you to get started quickly.

Copyright © 2018 Dan Allen, Guillaume Grossetie, Anthonny Quérouil and the Asciidoctor Project. Free use of this software is granted under the terms of the MIT License.

See the LICENSE file for details.