{"_id":"@asciidoc-js/reasciidoc-parse","name":"@asciidoc-js/reasciidoc-parse","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"author":{"name":"Pablo Angelani","email":"pablo.angelani@gmail.com","url":"https://www.linkedin.com/in/pabloangelani/"},"bugs":{"url":"https://github.com/asciidoc-js/reasciidoc/issues"},"dependencies":{"@asciidoctor/core":"^3.0.0","@asciidoc-js/adast":"^1.0.0","htmlparser2":"^12.0.0","unified":"^11.0.0"},"devDependencies":{"@types/node":"^20.0.0","@types/unist":"^3.0.3","tsx":"^4.0.0","typescript":"^5.0.0"},"description":"unified plugin to add support for parsing asciidoc input","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"default":"./dist/index.js"}},"homepage":"https://github.com/asciidoc-js/reasciidoc/#readme","keywords":["unist","adast","asciidoc","asciidoctor","ast","syntax-tree","parser","unified"],"license":"MIT","main":"./dist/index.js","name":"@asciidoc-js/reasciidoc-parse","repository":{"type":"git","url":"git+https://github.com/asciidoc-js/reasciidoc.git#main"},"scripts":{"build":"tsc","test":"node --import tsx --test test/*.test.ts","check":"tsc --noEmit"},"sideEffects":false,"type":"module","types":"./dist/index.d.ts","version":"0.1.0","gitHead":"59f5b82d77ad06abb1022d2ced64bbfef9e034c8","_id":"@asciidoc-js/reasciidoc-parse@0.1.0","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-TPjM27H81oS0nyeUDrrYcjv3IlpqY/AdjL8XYQO+DbW1aamo2ypeKvarFWvTEhLZqRGWJ5U28ypUh4q7ppNBWQ==","shasum":"26ab11283b14a76d4f7a526a799313d04f6c505f","tarball":"https://registry.npmjs.org/@asciidoc-js/reasciidoc-parse/-/reasciidoc-parse-0.1.0.tgz","fileCount":15,"unpackedSize":80527,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEIpU/9wJgzgtkivwYWFfzxNsUs5iopSCgesCllZyftMAiA0eb+bvSpuAAGE9pou+UU5XLPd2/krqvi9SPxGMnLopg=="}]},"_npmUser":{"name":"pablo.angelani","email":"pablo.angelani@gmail.com"},"directories":{},"maintainers":[{"name":"pablo.angelani","email":"pablo.angelani@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/reasciidoc-parse_0.1.0_1775443744414_0.6922321264216851"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-06T02:49:04.287Z","0.1.0":"2026-04-06T02:49:04.546Z","modified":"2026-04-06T02:49:04.791Z"},"maintainers":[{"name":"pablo.angelani","email":"pablo.angelani@gmail.com"}],"description":"unified plugin to add support for parsing asciidoc input","homepage":"https://github.com/asciidoc-js/reasciidoc/#readme","keywords":["unist","adast","asciidoc","asciidoctor","ast","syntax-tree","parser","unified"],"repository":{"type":"git","url":"git+https://github.com/asciidoc-js/reasciidoc.git#main"},"author":{"name":"Pablo Angelani","email":"pablo.angelani@gmail.com","url":"https://www.linkedin.com/in/pabloangelani/"},"bugs":{"url":"https://github.com/asciidoc-js/reasciidoc/issues"},"license":"MIT","readme":"# reasciidoc-parse\n\n**[reasciidoc][github-reasciidoc]** plugin to add support for parsing from AsciiDoc.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`unified().use(reasciidocParse)`](#unifiedusereasciidocparse)\n* [Examples](#examples)\n  * [Example: support AsciiDoc extensions](#example-support-asciidoc-extensions)\n  * [Example: turning AsciiDoc into HTML](#example-turning-asciidoc-into-html)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [unified][github-unified] ([reasciidoc][github-reasciidoc])\nplugin that defines how to take AsciiDoc as input and turn it into a syntax\ntree.\n\nSee [the monorepo readme][github-reasciidoc] for info on what the reasciidoc ecosystem\nis.\n\n## When should I use this?\n\nThis plugin adds support to unified for parsing AsciiDoc.\nIf you also need to serialize AsciiDoc,\nyou can alternatively use [`reasciidoc`][github-reasciidoc-core],\nwhich combines `unified`,\nthis plugin,\nand [`reasciidoc-stringify`][github-reasciidoc-stringify].\n\nIf you *just* want to turn AsciiDoc into HTML (with maybe a few extensions),\nwe recommend using this plugin with `rehype-stringify`.\nIf you don't use plugins and want to access the syntax tree,\nyou can directly use this package.\nreasciidoc focusses on making it easier to transform content by abstracting these\ninternals away.\n\nYou can combine this plugin with other plugins to add syntax extensions.\nYou can use any [reasciidoc plugin][github-reasciidoc-plugins]\nafter `reasciidoc-parse`.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+),\ninstall with [npm][npm-install]:\n\n```sh\nnpm install reasciidoc-parse\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport reasciidocParse from 'https://esm.sh/reasciidoc-parse@1'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import reasciidocParse from 'https://esm.sh/reasciidoc-parse@1?bundle'\n</script>\n```\n\n## Use\n\nSay we have the following module `example.js`:\n\n```js\nimport rehypeStringify from 'rehype-stringify'\nimport reasciidocParse from 'reasciidoc-parse'\nimport rehypeFromAsciiDoc from 'rehype-from-asciidoc'\nimport {unified} from 'unified'\n\nconst value = `\n= Mercury\n\n*Mercury* is the first planet from the https://en.wikipedia.org/wiki/Sun[Sun]\nand the smallest planet in the Solar System.\n`\n\nconst file = await unified()\n  .use(reasciidocParse)\n  .use(rehypeFromAsciiDoc)\n  .use(rehypeStringify)\n  .process(value)\n\nconsole.log(String(file))\n```\n\n…then running `node example.js` yields:\n\n```html\n<h1>Mercury</h1>\n<p><strong>Mercury</strong> is the first planet from the <a href=\"https://en.wikipedia.org/wiki/Sun\">Sun</a>\nand the smallest planet in the Solar System.</p>\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`reasciidocParse`][api-reasciidoc-parse].\n\n### `unified().use(reasciidocParse)`\n\nAdd support for parsing from AsciiDoc.\n\n###### Parameters\n\nThere are no parameters.\n\n###### Returns\n\nNothing (`undefined`).\n\n## Examples\n\n### Example: support AsciiDoc extensions\n\nWe support standard AsciiDoc by default.\nNon-standard AsciiDoc extensions can be enabled with plugins.\n\nThis example shows how to parse AsciiDoc with various features:\n\n```js\nimport rehypeStringify from 'rehype-stringify'\nimport reasciidocParse from 'reasciidoc-parse'\nimport rehypeFromAsciiDoc from 'rehype-from-asciidoc'\nimport {unified} from 'unified'\n\nconst doc = `\n= My Document\n\n== Section One\n\nHello *world* and https://example.com[links].\n\n[source,javascript]\n----\nconst x = 42\n----\n`\n\nconst file = await unified()\n  .use(reasciidocParse)\n  .use(rehypeFromAsciiDoc)\n  .use(rehypeStringify)\n  .process(doc)\n\nconsole.log(String(file))\n```\n\nYields:\n\n```html\n<div class=\"sect1\">\n<h2 id=\"_my_document\">My Document</h2>\n<div class=\"sectionbody\">\n<div class=\"sect2\">\n<h3 id=\"_section_one\">Section One</h3>\n<div class=\"paragraph\">\n<p>Hello <strong>world</strong> and <a href=\"https://example.com\">links</a>.</p>\n</div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight\"><code class=\"language-javascript\">const x = 42</code></pre>\n</div>\n</div>\n</div>\n</div>\n</div>\n```\n\n### Example: turning AsciiDoc into HTML\n\nThis example shows how to turn AsciiDoc into HTML by using unified with\n`reasciidoc-parse` and `rehype-stringify`:\n\n```js\nimport rehypeStringify from 'rehype-stringify'\nimport reasciidocParse from 'reasciidoc-parse'\nimport rehypeFromAsciiDoc from 'rehype-from-asciidoc'\nimport {unified} from 'unified'\n\nconst doc = `\n= Saturn's Moon\n\nTitan is the largest moon of Saturn and has a thick atmosphere.\n`\n\nconst file = await unified()\n  .use(reasciidocParse)\n  .use(rehypeFromAsciiDoc)\n  .use(rehypeStringify)\n  .process(doc)\n\nconsole.log(String(file))\n```\n\nYields:\n\n```html\n<div class=\"doc\">\n<div id=\"preamble\">\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Titan is the largest moon of Saturn and has a thick atmosphere.</p>\n</div>\n</div>\n</div>\n</div>\n```\n\n## Syntax\n\nAsciiDoc is parsed according to the AsciiDoc specification.\nOther plugins can add support for syntax extensions.\nIf you're interested in extending AsciiDoc,\nsee the [AsciiDoc Language Documentation][asciidoc-spec].\n\n## Syntax tree\n\nThe syntax tree used in reasciidoc is [adast][github-asciidoc-ast].\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type `Options` (which is currently empty).\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release,\nwe drop support for unmaintained versions of Node.\nThis means we try to keep the current release line,\n`reasciidoc-parse@1`,\ncompatible with Node.js 16.\n\n## Security\n\nSee [*§ Security* in `asciidoc-js/reasciidoc`][github-reasciidoc-security].\n\n## Contribute\n\nSee [`contributing.md`][health-contributing] in [`asciidoc-js/.github`][health]\nfor ways to get started.\n\n## License\n\n[MIT][file-license] © [AsciiDoc.js contributors][github-reasciidoc]\n\n<!-- Definitions -->\n\n[api-reasciidoc-parse]: #unifiedusereasciidocparse\n\n[asciidoc-spec]: https://docs.asciidoctor.org/asciidoc/latest/\n\n[badge-build-image]: https://github.com/asciidoc-js/reasciidoc/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/asciidoc-js/reasciidoc/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/asciidoc-js/reasciidoc.svg\n\n[badge-coverage-url]: https://codecov.io/github/asciidoc-js/reasciidoc\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/reasciidoc-parse.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/reasciidoc-parse\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/reasciidoc-parse\n\n[badge-size-url]: https://bundlejs.com/?q=reasciidoc-parse\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-asciidoc-ast]: https://github.com/asciidoc-js/adast\n\n[github-reasciidoc]: https://github.com/asciidoc-js/reasciidoc\n\n[github-reasciidoc-core]: https://github.com/asciidoc-js/reasciidoc/tree/main/packages/reasciidoc\n\n[github-reasciidoc-plugins]: https://github.com/asciidoc-js/reasciidoc#plugins\n\n[github-reasciidoc-security]: https://github.com/asciidoc-js/reasciidoc#security\n\n[github-reasciidoc-stringify]: https://github.com/asciidoc-js/reasciidoc/tree/main/packages/reasciidoc-stringify\n\n[github-unified]: https://github.com/unifiedjs/unified\n\n[health]: https://github.com/asciidoc-js/.github\n\n[health-coc]: https://github.com/asciidoc-js/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/asciidoc-js/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/asciidoc-js/.github/blob/main/support.md\n\n[npm-install]: https://docs.npmjs.com/cli/install\n\n[opencollective]: https://opencollective.com/unified\n\n[typescript]: https://www.typescriptlang.org","readmeFilename":"README.md","_rev":"1-a80364c90b981ae8d258aee2ee090153"}