Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
dist/ | 25-Sep-2023 | - | 141,540 | 104,038 | ||
types/ | 25-Sep-2023 | - | 3,728 | 892 | ||
LICENSE | D | 24-Sep-2023 | 1.1 KiB | 22 | 17 | |
README.md | D | 24-Sep-2023 | 1.3 KiB | 52 | 36 | |
package.json | D | 24-Sep-2023 | 4 KiB | 127 | 126 |
README.md
1# Asciidoctor core 2 3This package provides Asciidoctor core functionality: 4 5* parser 6* built-in converters 7* extensions 8 9## Install 10 11```console 12$ npm i @asciidoctor/core --save 13``` 14 15## Usage 16 17Here is a simple example that converts AsciiDoc to HTML5: 18 19**sample.js** 20 21```javascript 22const asciidoctor = require('@asciidoctor/core')() // ① 23const content = 'http://asciidoctor.org[*Asciidoctor*] ' + 24 'running on https://opalrb.com[_Opal_] ' + 25 'brings AsciiDoc to Node.js!' 26const html = asciidoctor.convert(content) // ② 27console.log(html) // ③ 28``` 291. Instantiate the Asciidoctor.js library 302. Convert AsciiDoc content to HTML5 using Asciidoctor.js 313. Print the HTML5 output to the console 32 33Save the file as _sample.js_ and run it using the `node` command: 34 35```console 36$ node sample.js 37``` 38 39You should see the following output in your terminal: 40 41```html 42<div class="paragraph"> 43<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> 44</div> 45``` 46 47If you want to know more about Asciidoctor.js, please read the [User Manual](https://asciidoctor-docs.netlify.com/asciidoctor.js/). 48 49## Changelog 50 51Refer to the [CHANGELOG](https://github.com/asciidoctor/asciidoctor.js/blob/main/CHANGELOG.adoc) for a complete list of changes. 52