{"_id":"@braindb/micromark-extension-wiki-link","name":"@braindb/micromark-extension-wiki-link","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@braindb/micromark-extension-wiki-link","version":"0.1.0","description":"Parse and render wiki-style links","keywords":["remark","remark-plugin","markdown","gfm","micromark","micromark-plugin"],"repository":{"type":"git","url":"git+https://github.com/stereobooster/braindb.git","directory":"packages/micromark-extension-wiki-link"},"contributors":[{"name":"Mark Hudnall","email":"me@markhudnall.com","url":"https://markhudnall.com"},{"name":"stereobooster"}],"license":"MIT","type":"module","sideEffects":false,"exports":{"types":"./dist/index.d.js","default":"./dist/index.js"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.js","devDependencies":{"micromark":"^4.0.0","vitest":"^1.6.0","vite-tsconfig-paths":"^4.3.2"},"dependencies":{"micromark-util-types":"^2.0.0"},"scripts":{"test":"vitest","build":"rm -rf dist && tsc","dev":"tsc --watch","clean":"rm -rf dist"},"bugs":{"url":"https://github.com/stereobooster/braindb/issues"},"homepage":"https://github.com/stereobooster/braindb#readme","_id":"@braindb/micromark-extension-wiki-link@0.1.0","_integrity":"sha512-bYGjvy/Yciisqty7zkC16dkg8gE9aWFpHGgYVRF/5H6N744V/fzjWTT/TtVCWgOk+/x+8rQCHRM8lOtobRE4Ow==","_resolved":"/private/var/folders/vv/fk4322kj49bcxmxz9kbnwjv00000gp/T/1e2efdeef52ccd17dda4c8b42debbbeb/braindb-micromark-extension-wiki-link-0.1.0.tgz","_from":"file:braindb-micromark-extension-wiki-link-0.1.0.tgz","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-bYGjvy/Yciisqty7zkC16dkg8gE9aWFpHGgYVRF/5H6N744V/fzjWTT/TtVCWgOk+/x+8rQCHRM8lOtobRE4Ow==","shasum":"39130b217eaade10fddff952f08d43a4739870b3","tarball":"https://registry.npmjs.org/@braindb/micromark-extension-wiki-link/-/micromark-extension-wiki-link-0.1.0.tgz","fileCount":9,"unpackedSize":12562,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDRnie3yBpWBYugUtP+/kV0UMh9sxL58NYTBKAf8f/E3AiEAoIL0UAThqOq2bm9kKT89RIvotwrbkscFZW5LMsx80C4="}]},"_npmUser":{"name":"stereobooster","email":"stereobooster@gmail.com"},"directories":{},"maintainers":[{"name":"stereobooster","email":"stereobooster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/micromark-extension-wiki-link_0.1.0_1715620066181_0.4918999322326061"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-13T17:07:46.100Z","0.1.0":"2024-05-13T17:07:46.328Z","modified":"2024-05-13T17:07:46.626Z"},"maintainers":[{"name":"stereobooster","email":"stereobooster@gmail.com"}],"description":"Parse and render wiki-style links","homepage":"https://github.com/stereobooster/braindb#readme","keywords":["remark","remark-plugin","markdown","gfm","micromark","micromark-plugin"],"repository":{"type":"git","url":"git+https://github.com/stereobooster/braindb.git","directory":"packages/micromark-extension-wiki-link"},"contributors":[{"name":"Mark Hudnall","email":"me@markhudnall.com","url":"https://markhudnall.com"},{"name":"stereobooster"}],"bugs":{"url":"https://github.com/stereobooster/braindb/issues"},"license":"MIT","readme":"# @braindb/micromark-extension-wiki-link\n\nfork of https://github.com/landakram/micromark-extension-wiki-link\n\n---\n\n# Old readme\n\nThis [micromark](https://github.com/micromark/micromark) extension parses and renders `[[Wiki Links]]`.\n\n- Parse wiki-style links and render them as anchors\n- Differentiate between \"new\" and \"existing\" wiki links by giving the parser a list of existing permalinks\n- Parse aliased wiki links i.e `[[Real Page:Page Alias]]`\n\nUsing [remark](https://github.com/remarkjs/remark)? You might want to use\n[`remark-wiki-link`](https://github.com/landakram/remark-wiki-link) instead of using this package directly.\n\n## Usage\n\n```javascript\nimport { syntax, html } from \"@braindb/micromark-extension-wiki-link\";\n\nlet serialized = micromark(\"[[Wiki Link]]\", {\n  extensions: [syntax()],\n  htmlExtensions: [html()],\n});\n\nconsole.log(serialized);\n// <p><a href=\"#/page/wiki_link\" class=\"internal\">Wiki Link</a></p>\n```\n\n### Configuration options\n\nBoth the syntax extension and html extension can be configured by passing an object.\n\nFor example, one may configure the syntax extension like so:\n\n```javascript\nlet serialized = micromark(\"[[Wiki Link]]\", {\n  extensions: [syntax({ aliasDivider: \":\" })],\n  htmlExtensions: [html()],\n});\n```\n\n#### `syntax`\n\n- `options.aliasDivider [String]`: a string to be used as the divider for aliases. See the section below on [Aliasing pages](#aliasing-pages). Defaults to `\"|\"`.\n\n#### `html`\n\n- `options.permalinks [String]`: An array of permalinks that should be considered existing pages. If a wiki link is parsed and its permalink matches one of these permalinks, `node.data.exists` will be true.\n- `options.pageResolver (pageName: String) -> [String]`: A function that maps a page name to an array of possible permalinks. These possible permalinks are cross-referenced with `options.permalinks` to determine whether a page exists. If a page doesn't exist, the first element of the array is considered the permalink.\n\n  The default `pageResolver` is:\n\n  ```javascript\n  (name) => [name.replace(/ /g, \"_\").toLowerCase()];\n  ```\n\n- `options.hrefTemplate (permalink: String) -> String`: A function that maps a permalink to some path. This path is used as the `href` for the rendered `a`.\n\n  The default `hrefTemplate` is:\n\n  ```javascript\n  (permalink) => `#/page/${permalink}`;\n  ```\n\n- `options.wikiLinkClassName [String]`: a class name that is attached to any rendered wiki links. Defaults to `\"internal\"`.\n- `options.newClassName [String]`: a class name that is attached to any rendered wiki links that do not exist. Defaults to `\"new\"`.\n\n### Aliasing pages\n\nAliased pages are supported with the following markdown syntax:\n\n```md\n[[Real Page|Page Alias]]\n```\n\nAnd will produce this HTML when rendered:\n\n```html\n<a class=\"internal new\" href=\"#/page/real_page\">Page Alias</a>\n```\n","readmeFilename":"README.md"}