Testing

Implementation is at ../parser/parser

js
return lit.parser.utils.links;
txtUpdated 29.5w ago
{ resolveLinks: [Function: resolveLinks],
  wikiLinkOptions: [Function: wikiLinkOptions],
  resolver: [Function: p],
  linkToUrl: [Function: h],
  decorateLinkNode: [Function: m] }
js
const { wikiLinkOptions, linkToUrl, decorateLinkNode } = lit.parser.utils.links

const resolve = wikiLinkOptions().pageResolver;

// console.info(resolve.toString())
// console.info(linkToUrl.toString())

const root = "/";
const type = "wikiLink";
const example = "testing/Links?foo=bar#baz|Title";
const resolved = resolve(example);
const link = {
  type,
  data: { permalink: resolved[0] },
  url: example,
  value: example,
};

const url = linkToUrl(link, root);

console.log({ root, example, resolved, link , url});

const decorated = decorateLinkNode(link);
return JSON.stringify(decorated, null, 2);

txtUpdated 29.5w ago
{ root: '/',
  example: 'testing/Links?foo=bar#baz|Title',
  resolved: [ '/testing/links.lit', '/testing/links.md', '/testing/links' ],
  link: 
   { type: 'wikiLink',
     data: { permalink: '/testing/links.lit' },
     url: 'testing/Links?foo=bar#baz|Title',
     value: 'testing/Links?foo=bar#baz|Title' },
  url: '/testing/links.lit' }
{
  "type": "link",
  "data": {
    "isExternal": false,
    "isAbsolute": true,
    "isFragment": false,
    "isRelative": false,
    "canonical": "/testing/links.lit",
    "wikilink": true,
    "hProperties": {
      "wikilink": true,
      "filepath": "",
      "root": "",
      "data": {
        "base": "/testing/links.lit",
        "isExternal": false,
        "isAbsolute": true,
        "isFragment": false,
        "isRelative": false,
        "canonical": "/testing/links.lit",
        "wikilink": true
      }
    }
  },
  "url": "testing/links.html",
  "title": "testing/Links?foo=bar#baz|Title",
  "children": [
    {
      "type": "text",
      "value": "testing/Links?foo=bar#baz|Title"
    }
  ]
}

  1. footnote With multi line contentโ†ฉ