diff --git a/src/md4w.zig b/src/md4w.zig index 7077a14..5e6292f 100644 --- a/src/md4w.zig +++ b/src/md4w.zig @@ -529,7 +529,7 @@ const JOSNRenderer = struct { if (code.lang.size > 0) { w.writeJSONProps(); w.write("\"lang\":\""); - w.writeJSONString(@as([*]const u8, @ptrCast(code.lang.text))[0..code.lang.size], 1); + w.writeJSONString(@as([*]const u8, @ptrCast(code.lang.text))[0..code.lang.size], 0); w.write("\"}"); } w.writeJSONChildren(); @@ -600,7 +600,7 @@ const JOSNRenderer = struct { w.writeJSONString(@as([*]const u8, @ptrCast(a.href.text))[0..a.href.size], 2); if (a.title.size > 0) { w.write("\",\"title\":"); - w.writeJSONString(@as([*]const u8, @ptrCast(a.title.text))[0..a.title.size], 1); + w.writeJSONString(@as([*]const u8, @ptrCast(a.title.text))[0..a.title.size], 0); } w.write("\"}"); w.writeJSONChildren(); @@ -647,7 +647,7 @@ const JOSNRenderer = struct { } if (img.title.size > 0) { w.write("\"title\":\""); - w.writeJSONString(@as([*]const u8, @ptrCast(img.title.text))[0..img.title.size], 1); + w.writeJSONString(@as([*]const u8, @ptrCast(img.title.text))[0..img.title.size], 0); w.write("\""); } w.write("}},"); @@ -701,9 +701,8 @@ const JOSNRenderer = struct { } }, else => { - const escape: u2 = if (typ == c.MD_TEXT_CODE) 0 else 1; w.writeByte('"'); - w.writeJSONString(@as([*]const u8, @ptrCast(ptr))[0..len], escape); + w.writeJSONString(@as([*]const u8, @ptrCast(ptr))[0..len], 0); w.write("\","); }, } diff --git a/test/test.js b/test/test.js index 19e2500..93265e1 100644 --- a/test/test.js +++ b/test/test.js @@ -15,10 +15,10 @@ await init(); Deno.test("render to string", async (t) => { await t.step("commonmark-spec", async () => { - const md = await Deno.readFile( + const specMd = await Deno.readFile( new URL("commonmark-spec.md", import.meta.url), ); - const html = mdToHtml(md); + const html = mdToHtml(specMd); assertIncludes(html, "