{"_id":"@andymatuschak/remark-wiki-link","name":"@andymatuschak/remark-wiki-link","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.5":{"name":"@andymatuschak/remark-wiki-link","description":"Parse and render wiki-style links","version":"1.0.5","keywords":["remark","remark-plugin","markdown","gfm"],"repository":{"type":"git","url":"git+https://github.com/andymatuschak/remark-wiki-link.git"},"license":"MIT","author":{"name":"Mark Hudnall","email":"me@markhudnall.com","url":"https://markhudnall.com"},"main":"dist/index.cjs.js","module":"dist/index.esm.js","browser":"dist/index.umd.js","scripts":{"build":"rollup -c","lint":"eslint src/ test/","prepare":"npm run build","pretest":"npm run build","test":"npm run lint && mocha --require @babel/register test/index_test.js"},"dependencies":{"@babel/runtime":"^7.4.4","mdast-util-wiki-link":"^0.1.1","micromark-extension-wiki-link":"^0.0.4"},"devDependencies":{"@babel/cli":"^7.12.10","@babel/core":"^7.4.4","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.4.4","@babel/register":"^7.4.4","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-commonjs":"^15.1.0","eslint":"^7.11.0","eslint-config-standard":"^14.1.1","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.1","mdast-util-from-markdown":"^0.8.4","mocha":"^6.2.3","rehype-stringify":"^8.0.0","remark-parse":"^9.0.0","remark-rehype":"^8.0.0","remark-stringify":"^9.0.1","rollup":"^2.32.0","unified":"^9.2.0","unist-util-select":"^3.0.4","unist-util-visit":"^2.0.3"},"_id":"@andymatuschak/remark-wiki-link@1.0.5","gitHead":"1d4f7f2dfbfb188faaf31127cc9318f80d8197d1","bugs":{"url":"https://github.com/andymatuschak/remark-wiki-link/issues"},"homepage":"https://github.com/andymatuschak/remark-wiki-link#readme","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-rYzOwCUppI7k1HS2hh+luAiks/7pU3MbFba0wSNLifwo5eMusF4PAIZN5HDxsXAd1g4FiYM6belFii9Ipd9sCw==","shasum":"268a40f99636b9404f5aa1100ce3d74c863026e7","tarball":"https://registry.npmjs.org/@andymatuschak/remark-wiki-link/-/remark-wiki-link-1.0.5.tgz","fileCount":17,"unpackedSize":16278,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEqgZ4OaKRzn9/QKgRp5mQ4RoQokASMxG2PcmU9qQPFVAiEAhxfT2Hg6871u8xPfCRWlDfV74rrKVURKgoWjqiILG+4="}]},"_npmUser":{"name":"andymatuschak","email":"andy@andymatuschak.org"},"directories":{},"maintainers":[{"name":"andymatuschak","email":"andy@andymatuschak.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remark-wiki-link_1.0.5_1696539290896_0.015452296713398761"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-05T20:54:50.817Z","1.0.5":"2023-10-05T20:54:51.099Z","modified":"2023-10-05T20:54:51.354Z"},"maintainers":[{"name":"andymatuschak","email":"andy@andymatuschak.org"}],"description":"Parse and render wiki-style links","homepage":"https://github.com/andymatuschak/remark-wiki-link#readme","keywords":["remark","remark-plugin","markdown","gfm"],"repository":{"type":"git","url":"git+https://github.com/andymatuschak/remark-wiki-link.git"},"author":{"name":"Mark Hudnall","email":"me@markhudnall.com","url":"https://markhudnall.com"},"bugs":{"url":"https://github.com/andymatuschak/remark-wiki-link/issues"},"license":"MIT","readme":"# remark-wiki-link\n[![npm version](https://badge.fury.io/js/remark-wiki-link.svg)](https://badge.fury.io/js/remark-wiki-link) [![Build Status](https://travis-ci.org/landakram/remark-wiki-link.svg?branch=master)](https://travis-ci.org/landakram/remark-wiki-link)\n\n⚠️ This plugin is affected by the new parser in remark ([`micromark`](https://github.com/micromark/micromark), see [`remarkjs/remark#536`](https://github.com/remarkjs/remark/pull/536)). **For remark 12, use v0.0.x of this package**. **For remark 13+, use v1.0.0 or above.**\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 [mdast-util-wiki-link](https://github.com/landakram/mdast-util-wiki-link/) for working with ASTs and [micromark-extension-wiki-link](https://github.com/landakram/micromark-extension-wiki-link) for working with tokens.\n\n## Usage\n\n```javascript\nconst unified = require('unified')\nconst markdown = require('remark-parse')\nconst wikiLinkPlugin = require('remark-wiki-link');\n\nlet processor = unified()\n    .use(markdown, { gfm: true })\n    .use(wikiLinkPlugin)\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```\n[[Test Page]]\n```\n\nA node will be created that looks like this:\n\n```javascript\n{\n    value: 'Test Page',\n    data: {\n        alias: 'Test Page',\n        permalink: 'test_page',\n        exists: false,\n        hName: 'a',\n        hProperties: {\n            className: 'internal new',\n            href: '#/page/test_page'\n        },\n        hChildren: [{\n            type: 'text',\n            value: 'Test Page'\n        }]\n    }\n}\n```\n\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.pageResolver`, which can be passed in when initializing the plugin. \n* `data.exists`: Whether the page exists. A page exists if its permalink is found in `options.permalinks`, passed when initializing the plugin.\n* `data.hProperties.className`: Classes that are automatically attached to the `a` when it is rendered as HTML. These are configurable with `options.wikiLinkClassName` and `options.newClassName`. `options.newClassName` is attached when `data.exists` is false.\n* `data.hProperties.href`: `href` value for the rendered `a`. This `href` is computed using `options.hrefTemplate`.\n\nWhen rendered to HTML, we get:\n\n```\n<a class=\"internal new\" href=\"#/page/test_page\">Test Page</a>\n```\n\n### Configuration options\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`: a class name that is attached to any rendered wiki links. Defaults to `\"internal\"`.\n* `options.newClassName`: a class name that is attached to any rendered wiki links that do not exist. Defaults to `\"new\"`.\n* `options.aliasDivider`: a string for `aliased pages`.\n\n#### Aliasing pages\n\nAliased pages are supported with the following markdown syntax: \n\n```\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        exists: false,\n        hName: 'a',\n        hProperties: {\n            className: 'internal new',\n            href: '#/page/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```\n<a class=\"internal new\" href=\"#/page/real_page\">Page Alias</a>\n```\n","readmeFilename":"README.md"}