UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

30 lines (29 loc) 963 B
"use client"; import { normalizeUri as s } from "../../../micromark-util-sanitize-uri/index.js"; function d(e, n) { const i = typeof e.options.clobberPrefix == "string" ? e.options.clobberPrefix : "user-content-", t = String(n.identifier).toUpperCase(), f = s(t.toLowerCase()), l = e.footnoteOrder.indexOf(t); let r, o = e.footnoteCounts.get(t); o === void 0 ? (o = 0, e.footnoteOrder.push(t), r = e.footnoteOrder.length) : r = l + 1, o += 1, e.footnoteCounts.set(t, o); const p = { type: "element", tagName: "a", properties: { href: "#" + i + "fn-" + f, id: i + "fnref-" + f + (o > 1 ? "-" + o : ""), dataFootnoteRef: !0, ariaDescribedBy: ["footnote-label"] }, children: [{ type: "text", value: String(r) }] }; e.patch(n, p); const c = { type: "element", tagName: "sup", properties: {}, children: [p] }; return e.patch(n, c), e.applyData(n, c); } export { d as footnoteReference };