{"_rev":"4-1bb1a06e37e9b1993d847218d7f593ed","time":{"created":"2026-04-06T04:28:22.909Z","modified":"2026-04-06T04:28:23.283Z","0.1.0":"2026-04-06T03:50:45.592Z","0.1.1":"2026-04-06T04:28:23.113Z"},"_id":"@asciidoc-js/reasciidoc-remark","name":"@asciidoc-js/reasciidoc-remark","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@asciidoc-js/reasciidoc-remark","version":"0.1.1","description":"reasciidoc plugin to transform to remark","license":"MIT","keywords":["unist","adast","mdast","asciidoc","markdown","ast","syntax-tree","converter","remark","reasciidoc"],"type":"module","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"types":"./dist/index.d.ts","main":"./dist/index.js","scripts":{"build":"tsc","test":"node --import tsx --test test/*.test.ts","check":"tsc --noEmit"},"dependencies":{"@asciidoc-js/adast":"^1.0.0","unified":"^11.0.0"},"devDependencies":{"@types/mdast":"^4.0.0","@types/node":"^20.0.0","@types/unist":"^3.0.3","tsx":"^4.0.0","typescript":"^5.0.0","vfile":"^6.0.3"},"gitHead":"85f35d9ec7da7b54a96f5d474d7073269f6b75cd","_id":"@asciidoc-js/reasciidoc-remark@0.1.1","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-eanSXMmoS3ZpYTl9RpIeL6MMNnQppzatkfgaVCM1dKwkycRCZZlLC8hAeT6n3m2wCG4iIAkaUHYSGzEBljv/Jw==","shasum":"77b4ea223a39c8fa2f761a8f3a054b5b3b85cbd3","tarball":"https://registry.npmjs.org/@asciidoc-js/reasciidoc-remark/-/reasciidoc-remark-0.1.1.tgz","fileCount":7,"unpackedSize":80139,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFIDVfdDZSTWjUa9IW6LrORG8qn0quTr+/zbkHm6BrS0AiEA2FGHhrDWoeN9cC/ZIGT5/wqpxzT/+1NUWPUQCm2wvvM="}]},"_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-remark_0.1.1_1775449702969_0.47375721664015713"},"_hasShrinkwrap":false}},"maintainers":[{"name":"pablo.angelani","email":"pablo.angelani@gmail.com"}],"description":"reasciidoc plugin to transform to remark","keywords":["unist","adast","mdast","asciidoc","markdown","ast","syntax-tree","converter","remark","reasciidoc"],"license":"MIT","readme":"# reasciidoc-remark\n\n**[reasciidoc][github-reasciidoc]** plugin that turns AsciiDoc into markdown to support\n**[remark][github-remark]**.\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(reasciidocRemark[, destination][, options])`](#unifiedusereasciidocremark-destination-options)\n  * [`Options`](#options)\n* [Examples](#examples)\n  * [Example: ignoring things](#example-ignoring-things)\n  * [Example: keeping some AsciiDoc](#example-keeping-some-asciidoc)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [unified][github-unified] ([reasciidoc][github-reasciidoc])\nplugin that switches from\nreasciidoc (the AsciiDoc ecosystem) to\nremark (the markdown ecosystem).\nIt does this by transforming the current AsciiDoc (adast) syntax tree into a markdown\n(mdast) syntax tree.\nreasciidoc plugins deal with adast and remark plugins deal with mdast,\nso plugins used after `reasciidoc-remark` have to be remark plugins.\n\nThe reason that there are different ecosystems for markdown and AsciiDoc is that\nturning AsciiDoc into markdown is,\nwhile frequently needed,\nnot the only purpose of AsciiDoc.\nChecking (linting) and formatting AsciiDoc are also common use cases for\nreasciidoc and AsciiDoc.\nThere are several aspects of AsciiDoc that do not translate 1-to-1 to markdown.\nIn some cases AsciiDoc contains more information than markdown:\nfor example,\nthere are several ways to add a link in AsciiDoc\n(as in,\nautolinks: `https://url`,\nresource links: `link:label[url]`,\nand reference links with definitions).\nIn other cases markdown contains more information than AsciiDoc:\nthere are many elements,\nwhich add new meaning (semantics),\navailable in markdown that aren’t available in AsciiDoc.\nIf there was just one AST,\nit would be quite hard to perform the tasks that several remark and reasciidoc\nplugins currently do.\n\n**unified** is a project that transforms content with abstract syntax trees\n(ASTs).\n**remark** adds support for markdown to unified.\n**reasciidoc** adds support for AsciiDoc to unified.\n**mdast** is the markdown AST that remark uses.\n**adast** is the AsciiDoc AST that reasciidoc uses.\nThis is a reasciidoc plugin that transforms adast into mdast to support remark.\n\n## When should I use this?\n\nThis project is useful when you want to turn AsciiDoc to markdown.\n\nThe remark plugin [`@asciidoc-js/remark-reasciidoc`][github-remark-reasciidoc] does the inverse of\nthis plugin.\nIt turns markdown into AsciiDoc.\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+),\ninstall with [npm][npmjs-install]:\n\n```sh\nnpm install reasciidoc-remark\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport reasciidocRemark from 'https://esm.sh/reasciidoc-remark@10'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import reasciidocRemark from 'https://esm.sh/reasciidoc-remark@10?bundle'\n</script>\n```\n\n## Use\n\nSay we have the following module `example.js`:\n\n```js\nimport reasciidocParse from '@asciidoc-js/reasciidoc-parse'\nimport reasciidocRemark from '@asciidoc-js/reasciidoc-remark'\nimport remarkStringify from 'remark-stringify'\nimport {fetch} from 'undici'\nimport {unified} from 'unified'\n\nconst text = \"= Example Document\\nDoc Writer <doc@example.com>\\n\\nAn example of a basic https://asciidoc.org[AsciiDoc] document prepared by {author}.\"\n\nconst file = await unified()\n  .use(reasciidocParse)\n  .use(reasciidocRemark)\n  .use(remarkStringify)\n  .process(text)\n\nconsole.log(String(file))\n```\n\nNow running `node example.js` yields:\n\n```markdown\n# Example Document\n\nAn example of a basic [AsciiDoc](https://asciidoc.org) document prepared by   Doc Writer.\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`reasciidocRemark`][api-reasciidoc-remark].\n\n### `unified().use(reasciidocRemark[, destination][, options])`\n\nTurn AsciiDoc into markdown.\n\n###### Parameters\n\n* `destination`\n  ([`Processor`][github-unified-processor], optional)\n  — processor\n* `options`\n  ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nTransform ([`Transformer`][github-unified-transformer]).\n\n###### Notes\n\n* if a [processor][github-unified-processor] is given,\n  runs the (remark) plugins used on it with an mdast tree,\n  then discards the result\n  ([*bridge mode*][github-unified-mode])\n* otherwise,\n  returns an mdast tree,\n  the plugins used after `reasciidocRemark` are remark plugins\n  ([*mutate mode*][github-unified-mode])\n\n> 👉 **Note**:\n> It’s highly unlikely that you want to pass a `processor`.\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `checked`\n  (`string`, default: `'[x]'`)\n  — value to use for a checked checkbox or radio input\n* `document`\n  (`boolean`, default: `true`)\n  — whether the given tree represents a complete document;\n  when the tree represents a complete document,\n  then things are wrapped in paragraphs when needed,\n  and otherwise they’re left as-is\n* `handlers`\n  (`Record<string, Handle>`, optional)\n  — object mapping tag names to functions handling the corresponding\n  elements;\n  merged into the defaults;\n  see\n  [`Handle` in `adast-util-to-mdast`][github-adast-util-to-mdast-handle]\n* `newlines`\n  (`boolean`, default: `false`)\n  — keep line endings when collapsing whitespace;\n  the default collapses to a single space\n* `nodeHandlers`\n  (`Record<string, NodeHandle>`, optional)\n  — object mapping node types to functions handling the corresponding nodes;\n  merged into the defaults;\n  see\n  [`NodeHandle` in `adast-util-to-mdast`][github-adast-util-to-mdast-node-handle]\n* `quotes` (`Array<string>`, default: `['\"']`)\n  — list of quotes to use;\n  each value can be one or two characters;\n  when two,\n  the first character determines the opening quote and the second the closing\n  quote at that level;\n  when one,\n  both the opening and closing quote are that character;\n  the order in which the preferred quotes appear determines which quotes to use\n  at which level of nesting;\n  so,\n  to prefer `‘’` at the first level of nesting,\n  and `“”` at the second,\n  pass `['‘’', '“”']`;\n  if `<q>`s are nested deeper than the given amount of quotes,\n  the markers wrap around:\n  a third level of nesting when using `['«»', '‹›']` should have double\n  guillemets,\n  a fourth single, a fifth double again,\n  etc\n* `unchecked`\n  (`string`, default: `'[ ]'`)\n  — value to use for an unchecked checkbox or radio input\n\n## Examples\n\n### Example: ignoring things\n\nIt’s possible to exclude something from within AsciiDoc when turning it into\nmarkdown,\nby wrapping it in an element with a `data-mdast` attribute set to `'ignore'`.\nFor example:\n\n```\n*Importance* and _emphasis_.\n```\n\nWith emphasis ignored:\n\n```\n**Importance** and .\n```\n\nIt’s also possible to pass a handler to ignore nodes,\nor create your own plugin that uses more advanced filters.\n\n### Example: keeping some AsciiDoc\n\nThe goal of this project is to map AsciiDoc to plain and readable markdown.\nThat means that certain elements are ignored (such as complex macros) or \"downgraded\"\n(such as videos to links).\nYou can change this by passing handlers.\n\nSay we have the following file `example.adoc`:\n\n```\naudio::ocean-waves.wav[start=60,opts=autoplay]\n```\n\nAnd our module `example.js` looks as follows:\n\n```js\n/**\n * @import {Html} from 'mdast'\n */\n\nimport reasciidocParse from '@asciidoc-js/reasciidoc-parse'\nimport reasciidocRemark from '@asciidoc-js/reasciidoc-remark'\nimport remarkStringify from 'remark-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(reasciidocParse, {fragment: true})\n  .use(reasciidocRemark, {\n    handlers: {\n      audio(state, node) {\n        /** @type {Html} */\n        const result = {type: 'html', value: `<audio src=\"${node.target}\" controls />`}\n        state.patch(node, result)\n        return result\n      }\n    }\n  })\n  .use(remarkStringify)\n  .process(await read('example.adoc'))\n\nconsole.log(String(file))\n```\n\nNow running `node example.js` yields:\n\n```\n<audio src=\"ocean-waves.wav\" controls />\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\nMore advanced types are exposed from\n[`adast-util-to-mdast`][github-adast-util-to-mdast].\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`@asciidoc-js/reasciidoc-remark@0.1.0`,\ncompatible with Node.js 16.\n\nThis plugin works with `unified` version 6+, `@asciidoc-js/reasciidoc-parse`,\nand `remark-stringify` version 3+ (used in `remark` version 7).\n\n## Security\n\nUse of `@asciidoc-js/reasciidoc-remark` is safe by default.\n\n## Related\n\n* [`@asciidoc-js/remark-reasciidoc`][github-remark-reasciidoc]\n  — remark plugin to turn markdown into AsciiDoc\n* [`remark-rehype`][github-remark-rehype]\n  — remark plugin to turn markdown into HTML\n* [`rehype-remark`][github-rehype-remark]\n  — rehype plugin to turn HTML into markdown\n\n## License\n\n[MIT][file-license] © [Pablo Angelani]\n\n<!-- Definitions -->\n\n[api-options]: #options\n\n[api-reasciidoc-remark]: #unifiedusereasciidocremark-destination-options\n\n[badge-build-image]: https://github.com/asciidoc-js/reasciidoc-remark/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/asciidoc-js/reasciidoc-remark/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/asciidoc-js/reasciidoc-remark.svg\n\n[badge-coverage-url]: https://codecov.io/github/asciidoc-js/reasciidoc-remark\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/reasciidoc-remark.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/reasciidoc-remark\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/reasciidoc-remark\n\n[badge-size-url]: https://bundlejs.com/?q=reasciidoc-remark\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-adast-util-to-mdast]: https://github.com/syntax-tree/adast-util-to-mdast\n\n[github-adast-util-to-mdast-handle]: https://github.com/syntax-tree/adast-util-to-mdast#handle\n\n[github-adast-util-to-mdast-node-handle]: https://github.com/syntax-tree/adast-util-to-mdast#nodehandle\n\n[github-reasciidoc]: https://github.com/asciidoc-js/reasciidoc\n\n[github-remark]: https://github.com/remarkjs/remark\n\n[github-remark-reasciidoc]: https://github.com/asciidoc-js/remark-reasciidoc\n\n[github-remark-rehype]: https://github.com/remarkjs/remark-rehype\n\n[github-rehype-remark]: https://github.com/rehypejs/rehype-remark\n\n[github-unified]: https://github.com/unifiedjs/unified\n\n[github-unified-mode]: https://github.com/unifiedjs/unified#transforming-between-ecosystems\n\n[github-unified-processor]: https://github.com/unifiedjs/unified#processor\n\n[github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\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[npmjs-install]: https://docs.npmjs.com/cli/install\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com","readmeFilename":"README.md"}