import { describe, expect, it } from "vitest"; import { renderInline } from "#lib/markup/inline.ts"; describe("renderInline", () => { it("keeps the allowed marks", () => { expect(renderInline("**b** *i* ~~s~~ `c`")).toBe( "b i s c" ); }); it("links labels and bare urls", () => { expect(renderInline("[docs](https://tangled.org/docs) https://tangled.org")).toBe( 'docs ' + 'https://tangled.org' ); }); it("keeps the label text when links are off", () => { expect(renderInline("[docs](https://tangled.org/docs)", false)).toBe("docs"); }); it("drops unsafe link schemes", () => { expect(renderInline("[x](javascript:alert(1))")).not.toContain(" { expect(renderInline("x")).toBe("<b>x</b>"); expect(renderInline("![alt](https://tangled.org/a.png)")).not.toContain("