MCPcopy Create free account
hub / github.com/github/docs / matcher

Function matcher

lib/render-content/plugins/rewrite-local-links.js:21–26  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

19
20// Matches any <a> tags with an href that starts with `/`
21const matcher = (node) =>
22 node.type === 'element' &&
23 node.tagName === 'a' &&
24 node.properties &&
25 node.properties.href &&
26 node.properties.href.startsWith('/')
27
28// Content authors write links like `/some/article/path`, but they need to be
29// rewritten on the fly to match the current language and page version

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected