Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix absolute links with files in markdown
Sebastian Martinez committed 2 years ago
commit f631c7f1718f086feba5f4e82f9b333e9b35ec01
parent 50d046ce86cf1aa1aa5ff43e8de79af1088654e0
3 files changed +24 -1
modified src/lib/markdown.ts
@@ -143,7 +143,7 @@ export class Renderer extends BaseRenderer {

const markedInstance = new Marked(
  katexMarkedExtension({ throwOnError: false }),
-
  markedLinkifyIt(),
+
  markedLinkifyIt({}, { fuzzyLink: false }),
  {
    extensions: [
      emojisMarkedExtension,
modified tests/e2e/project.spec.ts
@@ -451,6 +451,29 @@ test("external markdown link", async ({ page }) => {
  await expect(page).toHaveURL("https://example.com");
});

+
test("internal file markdown link", async ({ page }) => {
+
  await page.goto(`${markdownUrl}/tree/main/link-files.md`);
+
  await page.getByRole("link", { name: "Markdown Cheatsheet" }).click();
+
  await expect(page).toHaveURL(`${markdownUrl}/tree/main/cheatsheet.md`);
+
  await expect(
+
    page.locator(".file-header", { hasText: "cheatsheet.md" }),
+
  ).toBeVisible();
+

+
  await page.goto(`${markdownUrl}/tree/main/link-files.md`);
+
  await page.getByRole("link", { name: "black square" }).click();
+
  await expect(page).toHaveURL(
+
    `${markdownUrl}/tree/main/assets/black-square.png`,
+
  );
+
  await expect(
+
    page.locator(".file-header", {
+
      hasText: "assets/".concat(String.fromCharCode(160), "​black-square.png"),
+
    }),
+
  ).toBeVisible();
+
  await expect(
+
    page.getByRole("link", { name: "black-square.png" }),
+
  ).toBeVisible();
+
});
+

test("diff selection de-select", async ({ page }) => {
  await page.goto(
    `${cobUrl}/patches/013f8b2734df1840b2e33d52ff5632c8d66b199a?tab=files#README.md:H0L0H0L3`,
modified tests/fixtures/repos/markdown.tar.bz2