mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-31 17:20:44 +08:00
Update footnote regex to handle footnotes with spaces
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ const footnoteReferenceMarkedExtension = {
|
||||
renderer: (token: Tokens.Generic): string =>
|
||||
`<sup class="txt-tiny footnote-ref" id="${referencePrefix}:${token.text}"><a href="#${footnotePrefix}:${token.text}">[${token.text}]</a></sup>`,
|
||||
};
|
||||
const footnoteMatch = /^\[\^([^\]]+)\]:\s([\S]*)/;
|
||||
const footnoteMatch = /^\[\^([^\]]+)\]:\s([\S].*)/;
|
||||
const footnoteMarkedExtension = {
|
||||
name: "footnote",
|
||||
level: "block",
|
||||
|
||||
BIN
Binary file not shown.
@@ -103,22 +103,32 @@ test("footnotes", async ({ page }) => {
|
||||
});
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=This is an example footnote[0]. And some radicle[1] examples.",
|
||||
"text=This is an example footnote[1]. And some radicle[2] examples.[3]",
|
||||
),
|
||||
).toBeVisible();
|
||||
await page.getByRole("button", { name: "Collapse" }).click();
|
||||
await expect(page.getByText("0. https://example.com ↩")).toBeVisible();
|
||||
await expect(page.getByText("1. https://radicle.xyz ↩")).toBeVisible();
|
||||
await expect(page.getByText("1. https://example.com ↩")).toBeVisible();
|
||||
await expect(page.getByText("2. https://radicle.xyz ↩")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
"3. A corporeal grounding, though one hardly to the exclusion of the cerebral as in the erroneous sense of a mind/body dichotomy, except insofar as what is most squarely in the cerebral would land here only on the periphery of our focus. ↩",
|
||||
),
|
||||
).toBeVisible();
|
||||
await expect(page).toHaveScreenshot({ fullPage: true });
|
||||
|
||||
await page.getByText("Code").click();
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=This is an example footnote[^0]. And some radicle[^1] examples.",
|
||||
"text=This is an example footnote[^1]. And some radicle[^2] examples.[^3]",
|
||||
),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("[^1]: https://example.com")).toBeVisible();
|
||||
await expect(page.getByText("[^2]: https://radicle.xyz")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
"[^3]: A corporeal grounding, though one hardly to the exclusion of the _cerebral_ as in the erroneous sense of a mind/body dichotomy, except insofar as what is most squarely in the cerebral would land here only on the periphery of our focus.",
|
||||
),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("[^0]: https://example.com")).toBeVisible();
|
||||
await expect(page.getByText("[^1]: https://radicle.xyz")).toBeVisible();
|
||||
});
|
||||
|
||||
test("math", async ({ page }) => {
|
||||
|
||||
Reference in New Issue
Block a user