{"_id":"@braindb/remark-wiki-link","name":"@braindb/remark-wiki-link","dist-tags":{"latest":"2.1.0"},"versions":{"2.1.0":{"name":"@braindb/remark-wiki-link","description":"Parse and render wiki-style links","version":"2.1.0","keywords":["remark","remark-plugin","markdown","gfm"],"repository":{"type":"git","url":"git+https://github.com/stereobooster/braindb.git","directory":"packages/remark-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","dependencies":{"@braindb/mdast-util-wiki-link":"^0.2.0","@braindb/micromark-extension-wiki-link":"^0.1.0"},"devDependencies":{"@types/unist":"^3.0.2","mdast-util-from-markdown":"^2.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0","remark-stringify":"^11.0.0","typescript":"^5.4.5","unified":"^11.0.4","unist-util-select":"^5.1.0","unist-util-visit":"^5.0.0","vite-tsconfig-paths":"^4.3.2","vitest":"^1.6.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/remark-wiki-link@2.1.0","_integrity":"sha512-+1ft071hNQR1lE62amhZ8cmFmVTuKJGBrwXIlZ1bM8yw0tVDpywEPlBbJZzt3ExtGDq0I+GaHjXFSe83YZLgGA==","_resolved":"/private/var/folders/vv/fk4322kj49bcxmxz9kbnwjv00000gp/T/2051e676bb794e8495c984ff038ecb64/braindb-remark-wiki-link-2.1.0.tgz","_from":"file:braindb-remark-wiki-link-2.1.0.tgz","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-+1ft071hNQR1lE62amhZ8cmFmVTuKJGBrwXIlZ1bM8yw0tVDpywEPlBbJZzt3ExtGDq0I+GaHjXFSe83YZLgGA==","shasum":"7162dfb4cfa0ca9312e90aa79c692b559082f586","tarball":"https://registry.npmjs.org/@braindb/remark-wiki-link/-/remark-wiki-link-2.1.0.tgz","fileCount":6,"unpackedSize":7865,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIALg7B5vZp+AtHWeyWMBUgj6iaLwD81tuvRVxucJG3omAiBGsNt3F1zpEWkpkXNCXAc2NqRLZDy20pr1FpsFGOdYOg=="}]},"_npmUser":{"name":"stereobooster","email":"stereobooster@gmail.com"},"directories":{},"maintainers":[{"name":"stereobooster","email":"stereobooster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-wiki-link_2.1.0_1715620103569_0.06104277766510391"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-13T17:08:23.472Z","2.1.0":"2024-05-13T17:08:23.725Z","modified":"2024-05-13T17:08:24.112Z"},"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"],"repository":{"type":"git","url":"git+https://github.com/stereobooster/braindb.git","directory":"packages/remark-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/remark-wiki-link\n\nfork of https://github.com/landakram/remark-wiki-link\n\n---\n\nThis [remark](https://github.com/wooorm/remark) plugin 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\nLooking for lower level packages? Check out [@braindb/mdast-util-wiki-link](https://github.com/stereobooster/braindb/tree/main/packages/mdast-util-wiki-link) for working with ASTs and [@braindb/micromark-extension-wiki-link](https://github.com/stereobooster/braindb/tree/main/packages/micromark-extension-wiki-link) for working with tokens.\n\n## Usage\n\n```javascript\nconst unified = require(\"unified\");\nconst markdown = require(\"remark-parse\");\nconst remarkWikiLink = require(\"@braindb/remark-wiki-link\");\n\nlet processor = unified().use(markdown, { gfm: true }).use(remarkWikiLink);\n```\n\nWhen the processor is run, wiki links will be parsed to a `wikiLink` node.\n\nIf we have this markdown string:\n\n```md\n[[Test Page]]\n```\n\n```javascript\n{\n    value: 'Test Page',\n    data: {\n        alias: 'Test Page',\n        permalink: 'Test Page',\n        hName: 'a',\n        hProperties: {\n            href: 'Test Page',\n        },\n        hChildren: [{\n            type: 'text',\n            value: 'Test Page'\n        }]\n    }\n}\n```\n\n- `value`: slug of the page\n- `data.alias`: The display name for this link\n- `data.permalink`: The permalink for this page. This permalink is computed from `node.value` using `options.linkResolver`, which can be passed in when initializing the plugin.\n- `data.hProperties.href`: `href` value for the rendered `a`. This `href` is computed using `options.hrefTemplate`.\n\nThe `hName` and other `h` fields provide compatibility with [`rehype`](https://github.com/rehypejs/rehype).\n\nWhen rendered to HTML, we get:\n\n```html\n<a href=\"Test Page\">Test Page</a>\n```\n\n### Configuration options\n\n- `options.linkResolver (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 `linkResolver` is:\n\n  ```javascript\n  (name) => name;\n  ```\n\n- `options.linkTemplate ({ slug: string, permalink: string, alias: string | null }) -> HAST`: A function that generates \"HAST\" for link.\n\n  The default `linkTemplate` is:\n\n  ```js\n  function defaultLinkTemplate({ slug, permalink, alias }) {\n    return {\n      hName: \"a\",\n      hProperties: { href: permalink == null ? slug : permalink },\n      hChildren: [{ type: \"text\", value: alias == null ? slug : alias }],\n    };\n  }\n  ```\n\n- `options.aliasDivider`: a string for `aliased pages`. . Defaults to `\"|\"`.\n\n#### Aliasing pages\n\nAliased pages are supported with the following markdown syntax:\n\n```md\n[[Real Page|Page Alias]]\n```\n\nThe AST node will look like:\n\n```javascript\n{\n    value: 'Real Page',\n    data: {\n        alias: 'Page Alias',\n        permalink: 'Real Page',\n        hName: 'a',\n        hProperties: {\n            href: 'Real Page'\n        },\n        hChildren: [{\n            type: 'text',\n            value: 'Page Alias'\n        }]\n    }\n}\n```\n\nAnd will produce this HTML when rendered:\n\n```html\n<a href=\"Real Page\">Page Alias</a>\n```\n","readmeFilename":"README.md"}