MCPcopy Create free account
hub / github.com/api-platform/website / getLinkNode

Function getLinkNode

pwa/next.config.mjs:16–30  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

14 */
15function transformCustomLinks() {
16 function getLinkNode(text) {
17 const linkMatch = text.match(/<a href="(\/\S+)">([^\s<]+)<\/a>/);
18
19 if (!linkMatch) {
20 return null;
21 }
22
23 const [, linkHref, linkText] = linkMatch;
24 return {
25 type: "element",
26 tagName: "a",
27 properties: { href: linkHref },
28 children: [{ type: "text", value: linkText }],
29 };
30 }
31
32 return (tree) => {
33 visit(tree, "element", (code) => {

Callers 1

transformCustomLinksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected