diff --git a/ziglue/.envrc b/ziglue/.envrc new file mode 100644 index 0000000..08f9db7 --- /dev/null +++ b/ziglue/.envrc @@ -0,0 +1,3 @@ +PATH_add zig-out/bin +source .venv/bin/activate + diff --git a/ziglue/.gitignore b/ziglue/.gitignore new file mode 100644 index 0000000..e73c22a --- /dev/null +++ b/ziglue/.gitignore @@ -0,0 +1,5 @@ +.zig-cache/ +zig-out/ + +.spec/ + diff --git a/ziglue/.tool-versions b/ziglue/.tool-versions new file mode 100644 index 0000000..f81adbc --- /dev/null +++ b/ziglue/.tool-versions @@ -0,0 +1 @@ +zig master diff --git a/ziglue/README.md b/ziglue/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ziglue/build.zig b/ziglue/build.zig new file mode 100644 index 0000000..271bf91 --- /dev/null +++ b/ziglue/build.zig @@ -0,0 +1,46 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const exe = b.addExecutable(.{ + .name = "ziglue", + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }); + + b.installArtifact(exe); + + const run_cmd = b.addRunArtifact(exe); + + run_cmd.step.dependOn(b.getInstallStep()); + + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + const exe_unit_tests = b.addTest(.{ + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }); + + const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); + + const example_tests = b.addTest(.{ + .root_source_file = b.path("src/examples.zig"), + .target = target, + .optimize = optimize, + }); + + const run_example_tests = b.addRunArtifact(example_tests); + + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_exe_unit_tests.step); + test_step.dependOn(&run_example_tests.step); +} diff --git a/ziglue/build.zig.zon b/ziglue/build.zig.zon new file mode 100644 index 0000000..23fe8b7 --- /dev/null +++ b/ziglue/build.zig.zon @@ -0,0 +1,10 @@ +.{ + .name = "ziglue", + .version = "0.0.0", + + .paths = .{ + "build.zig", + "build.zig.zon", + "src", + }, +} diff --git a/ziglue/examples.py b/ziglue/examples.py new file mode 100644 index 0000000..b1bc98a --- /dev/null +++ b/ziglue/examples.py @@ -0,0 +1,61 @@ +import parsel +import httpx +from pathlib import Path +from textwrap import indent +from subprocess import Popen, PIPE + +VERSION = '0.31.2' + +CACHE = Path('.spec', VERSION) +URL = f'https://spec.commonmark.org/{VERSION}/' + +if CACHE.exists(): + sel = parsel.Selector(CACHE.read_text()) +else: + response = httpx.get('https://spec.commonmark.org/0.31.2/') + response.raise_for_status() + CACHE.parent.mkdir(parents=True, exist_ok=True) + CACHE.write_text(response.text) + sel = parsel.Selector(response.text) + + +formatter = Popen(['zig', 'fmt', '--stdin'], stdin=PIPE, encoding='utf-8') +assert formatter.stdin + +write = formatter.stdin.write + +write(f''' + //! Example cases from Commonmark spec {VERSION} + //! {URL} + + const std = @import("std"); + const convert = @import("main.zig").convert; +''') + +for example in sel.css('.example'): + name = example.css('.examplenum > a::text').get() + + md = ''.join(example.css('.language-markdown *::text').getall()) + html = ''.join(example.css('.language-html *::text').getall()) + + md = md.replace('→', ' ') + html = html.replace('→', ' ') + + assert name is not None + + write(f''' + test "{name}" {{ + const output = try convert(std.testing.allocator, + {indent(md, r'\\', lambda _: True) if md else '""'} + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + {indent(html, r'\\', lambda _: True) if html else '""'} + , + output + ); + }} + ''') + +formatter.stdin.close() diff --git a/ziglue/notes.md b/ziglue/notes.md new file mode 100644 index 0000000..a4de5b6 --- /dev/null +++ b/ziglue/notes.md @@ -0,0 +1,37 @@ +The spec is organized into "content blocks", "leaf blocks", and inline content. I should take this as a hint to do the same. + +So the first task in the parser should be to parse the block structure. + + + +- Blocks + - Leaf + - Thematic break + - ATX heading + - Setext heading + - Indented chunk + + Indented code block is a sequence of indented chunks. + + Preserve count of blank lines. + - Fenced code block + - HTML blocks + - Link reference definition + - Paragraph + - Blank lines + + These are part of the document, but they are not rendered. + - Container + - Blockquote + - List Item + + List is a sequence of list items of the same type. + +- Inline + - Inline code + - Strong, emph + - Links + - Inline + - Reference + - Images + - Auto + - HTML + - Text + + \ No newline at end of file diff --git a/ziglue/pyparse.py b/ziglue/pyparse.py new file mode 100644 index 0000000..27db082 --- /dev/null +++ b/ziglue/pyparse.py @@ -0,0 +1,112 @@ +import sys +from enum import Enum, auto +from idlelib.configdialog import is_int +from pathlib import Path +from pprint import pprint +from typing import Optional + + +class Block: + def __init__(self, *parts): + self.tag = type(self).__name__ + self.data = list(parts) + + def extend(self, *parts): + self.data.extend(parts) + + def __repr__(self): + return f'{self.tag}:: {''.join(self.data)!r}' + + +class Break(Block): pass + + +class ATXHeading(Block): pass + + +class SetextHeading(Block): pass + + +class IndentedChunk(Block): pass + + +class Fence(Block): + def __init__(self, meta, *data): + super().__init__(*data) + self.meta = meta + self.complete = False + + def __repr__(self): + return f'{self.tag}:{self.meta}:: {''.join(self.data)!r}' + + +class HTML(Block): pass + + +class Definition(Block): pass + + +class Paragraph(Block): pass + + +class Blank(Block): pass + + +def convert(md: str): + blocks: list[Block] = [] + + cur_fence: Optional[Fence] = None + + def get(idx): + try: + return blocks[idx] + except IndexError: + return None + + for line in md.splitlines(keepends=True): + if cur_fence: + if line.lstrip(' ').startswith('```'): + blocks.append(cur_fence) + cur_fence = None + else: + cur_fence.extend(line) + else: + if line.isspace(): + if len(blocks) >= 1 and isinstance(blocks[-1], Blank): + blocks[-1].extend(line) + else: + blocks.append(Blank(line)) + + elif line.startswith(' ') or line.startswith('\t'): + if len(blocks) >= 1 and isinstance(blocks[-1], IndentedChunk): + blocks[-1].extend(line) + elif len(blocks) >= 2 and isinstance(blocks[-1], Blank) and isinstance(blocks[-2], IndentedChunk): + blocks[-2].extend(*blocks[-1].data, line) + blocks.pop(-1) + else: + blocks.append(IndentedChunk(line)) + + elif line.lstrip(' ').startswith('```'): + meta = line.strip().removeprefix('```') + cur_fence = Fence(meta) + else: + if len(blocks) >= 1 and isinstance(blocks[-1], Paragraph): + blocks[-1].extend(line) + else: + blocks.append(Paragraph(line)) + + pprint(blocks) + + +def main(): + for arg in sys.argv[1:]: + md = Path(arg).read_text() + html = convert(md) + + print('=' * 80) + print(html) + print('=' * 80) + + +if __name__ == '__main__': + main() diff --git a/ziglue/requirements.txt b/ziglue/requirements.txt new file mode 100644 index 0000000..e7a2eec --- /dev/null +++ b/ziglue/requirements.txt @@ -0,0 +1,2 @@ +httpx +parsel diff --git a/ziglue/src/examples.zig b/ziglue/src/examples.zig new file mode 100644 index 0000000..d7e6664 --- /dev/null +++ b/ziglue/src/examples.zig @@ -0,0 +1,9146 @@ +//! Example cases from Commonmark spec 0.31.2 +//! https://spec.commonmark.org/0.31.2/ + +const std = @import("std"); +const convert = @import("main.zig").convert; + +test "Example 1" { + const output = try convert(std.testing.allocator, + \\ foo baz bim + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo    baz        bim
+        \\
+ , output); +} + +test "Example 2" { + const output = try convert(std.testing.allocator, + \\ foo baz bim + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo    baz        bim
+        \\
+ , output); +} + +test "Example 3" { + const output = try convert(std.testing.allocator, + \\ a a + \\ ὐ a + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
a    a
+        \\ὐ    a
+        \\
+ , output); +} + +test "Example 4" { + const output = try convert(std.testing.allocator, + \\ - foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 5" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 6" { + const output = try convert(std.testing.allocator, + \\> foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
  foo
+        \\
+ \\
+ , output); +} + +test "Example 7" { + const output = try convert(std.testing.allocator, + \\- foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 8" { + const output = try convert(std.testing.allocator, + \\ foo + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\bar
+        \\
+ , output); +} + +test "Example 9" { + const output = try convert(std.testing.allocator, + \\ - foo + \\ - bar + \\ - baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 10" { + const output = try convert(std.testing.allocator, + \\# Foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 11" { + const output = try convert(std.testing.allocator, + \\* * * + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 12" { + const output = try convert(std.testing.allocator, + \\\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

+ , output); +} + +test "Example 13" { + const output = try convert(std.testing.allocator, + \\\ \A\a\ \3\φ\« + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

\ \A\a\ \3\φ\«

+ , output); +} + +test "Example 14" { + const output = try convert(std.testing.allocator, + \\\*not emphasized* + \\\
not a tag + \\\[not a link](/foo) + \\\`not code` + \\1\. not a list + \\\* not a list + \\\# not a heading + \\\[foo]: /url "not a reference" + \\\ö not a character entity + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*not emphasized* + \\<br/> not a tag + \\[not a link](/foo) + \\`not code` + \\1. not a list + \\* not a list + \\# not a heading + \\[foo]: /url "not a reference" + \\&ouml; not a character entity

+ , output); +} + +test "Example 15" { + const output = try convert(std.testing.allocator, + \\\\*emphasis* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

\emphasis

+ , output); +} + +test "Example 16" { + const output = try convert(std.testing.allocator, + \\foo\ + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\bar

+ , output); +} + +test "Example 17" { + const output = try convert(std.testing.allocator, + \\`` \[\` `` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

\[\`

+ , output); +} + +test "Example 18" { + const output = try convert(std.testing.allocator, + \\ \[\] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
\[\]
+        \\
+ , output); +} + +test "Example 19" { + const output = try convert(std.testing.allocator, + \\~~~ + \\\[\] + \\~~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
\[\]
+        \\
+ , output); +} + +test "Example 20" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

https://example.com?find=\*

+ , output); +} + +test "Example 21" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 22" { + const output = try convert(std.testing.allocator, + \\[foo](/bar\* "ti\*tle") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 23" { + const output = try convert(std.testing.allocator, + \\[foo] + \\ + \\[foo]: /bar\* "ti\*tle" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 24" { + const output = try convert(std.testing.allocator, + \\``` foo\+bar + \\foo + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\
+ , output); +} + +test "Example 25" { + const output = try convert(std.testing.allocator, + \\  & © Æ Ď + \\¾ ℋ ⅆ + \\∲ ≧̸ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

  & © Æ Ď + \\¾ ℋ ⅆ + \\∲ ≧̸

+ , output); +} + +test "Example 26" { + const output = try convert(std.testing.allocator, + \\# Ӓ Ϡ � + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

# Ӓ Ϡ �

+ , output); +} + +test "Example 27" { + const output = try convert(std.testing.allocator, + \\" ആ ಫ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

" ആ ಫ

+ , output); +} + +test "Example 28" { + const output = try convert(std.testing.allocator, + \\  &x; &#; &#x; + \\� + \\&#abcdef0; + \\&ThisIsNotDefined; &hi?; + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

&nbsp &x; &#; &#x; + \\&#87654321; + \\&#abcdef0; + \\&ThisIsNotDefined; &hi?;

+ , output); +} + +test "Example 29" { + const output = try convert(std.testing.allocator, + \\© + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

&copy

+ , output); +} + +test "Example 30" { + const output = try convert(std.testing.allocator, + \\&MadeUpEntity; + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

&MadeUpEntity;

+ , output); +} + +test "Example 31" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 32" { + const output = try convert(std.testing.allocator, + \\[foo](/föö "föö") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 33" { + const output = try convert(std.testing.allocator, + \\[foo] + \\ + \\[foo]: /föö "föö" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 34" { + const output = try convert(std.testing.allocator, + \\``` föö + \\foo + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\
+ , output); +} + +test "Example 35" { + const output = try convert(std.testing.allocator, + \\`föö` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

f&ouml;&ouml;

+ , output); +} + +test "Example 36" { + const output = try convert(std.testing.allocator, + \\ föfö + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
f&ouml;f&ouml;
+        \\
+ , output); +} + +test "Example 37" { + const output = try convert(std.testing.allocator, + \\*foo* + \\*foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo* + \\foo

+ , output); +} + +test "Example 38" { + const output = try convert(std.testing.allocator, + \\* foo + \\ + \\* foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

* foo

+ \\ + , output); +} + +test "Example 39" { + const output = try convert(std.testing.allocator, + \\foo bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\ + \\bar

+ , output); +} + +test "Example 40" { + const output = try convert(std.testing.allocator, + \\ foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 41" { + const output = try convert(std.testing.allocator, + \\[a](url "tit") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[a](url "tit")

+ , output); +} + +test "Example 42" { + const output = try convert(std.testing.allocator, + \\- `one + \\- two` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 43" { + const output = try convert(std.testing.allocator, + \\*** + \\--- + \\___ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
+ , output); +} + +test "Example 44" { + const output = try convert(std.testing.allocator, + \\+++ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+++

+ , output); +} + +test "Example 45" { + const output = try convert(std.testing.allocator, + \\=== + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

===

+ , output); +} + +test "Example 46" { + const output = try convert(std.testing.allocator, + \\-- + \\** + \\__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

-- + \\** + \\__

+ , output); +} + +test "Example 47" { + const output = try convert(std.testing.allocator, + \\ *** + \\ *** + \\ *** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
+ , output); +} + +test "Example 48" { + const output = try convert(std.testing.allocator, + \\ *** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
***
+        \\
+ , output); +} + +test "Example 49" { + const output = try convert(std.testing.allocator, + \\Foo + \\ *** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\***

+ , output); +} + +test "Example 50" { + const output = try convert(std.testing.allocator, + \\_____________________________________ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 51" { + const output = try convert(std.testing.allocator, + \\ - - - + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 52" { + const output = try convert(std.testing.allocator, + \\ ** * ** * ** * ** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 53" { + const output = try convert(std.testing.allocator, + \\- - - - + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 54" { + const output = try convert(std.testing.allocator, + \\- - - - + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 55" { + const output = try convert(std.testing.allocator, + \\_ _ _ _ a + \\ + \\a------ + \\ + \\---a--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_ _ _ _ a

+ \\

a------

+ \\

---a---

+ , output); +} + +test "Example 56" { + const output = try convert(std.testing.allocator, + \\ *-* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

-

+ , output); +} + +test "Example 57" { + const output = try convert(std.testing.allocator, + \\- foo + \\*** + \\- bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\
+ \\ + , output); +} + +test "Example 58" { + const output = try convert(std.testing.allocator, + \\Foo + \\*** + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\
+ \\

bar

+ , output); +} + +test "Example 59" { + const output = try convert(std.testing.allocator, + \\Foo + \\--- + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\

bar

+ , output); +} + +test "Example 60" { + const output = try convert(std.testing.allocator, + \\* Foo + \\* * * + \\* Bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\
+ \\ + , output); +} + +test "Example 61" { + const output = try convert(std.testing.allocator, + \\- Foo + \\- * * * + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 62" { + const output = try convert(std.testing.allocator, + \\# foo + \\## foo + \\### foo + \\#### foo + \\##### foo + \\###### foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\

foo

+ \\

foo

+ \\

foo

+ \\
foo
+ \\
foo
+ , output); +} + +test "Example 63" { + const output = try convert(std.testing.allocator, + \\####### foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

####### foo

+ , output); +} + +test "Example 64" { + const output = try convert(std.testing.allocator, + \\#5 bolt + \\ + \\#hashtag + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

#5 bolt

+ \\

#hashtag

+ , output); +} + +test "Example 65" { + const output = try convert(std.testing.allocator, + \\\## foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

## foo

+ , output); +} + +test "Example 66" { + const output = try convert(std.testing.allocator, + \\# foo *bar* \*baz\* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar *baz*

+ , output); +} + +test "Example 67" { + const output = try convert(std.testing.allocator, + \\# foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 68" { + const output = try convert(std.testing.allocator, + \\ ### foo + \\ ## foo + \\ # foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\

foo

+ \\

foo

+ , output); +} + +test "Example 69" { + const output = try convert(std.testing.allocator, + \\ # foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
# foo
+        \\
+ , output); +} + +test "Example 70" { + const output = try convert(std.testing.allocator, + \\foo + \\ # bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\# bar

+ , output); +} + +test "Example 71" { + const output = try convert(std.testing.allocator, + \\## foo ## + \\ ### bar ### + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\

bar

+ , output); +} + +test "Example 72" { + const output = try convert(std.testing.allocator, + \\# foo ################################## + \\##### foo ## + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\
foo
+ , output); +} + +test "Example 73" { + const output = try convert(std.testing.allocator, + \\### foo ### + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 74" { + const output = try convert(std.testing.allocator, + \\### foo ### b + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo ### b

+ , output); +} + +test "Example 75" { + const output = try convert(std.testing.allocator, + \\# foo# + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo#

+ , output); +} + +test "Example 76" { + const output = try convert(std.testing.allocator, + \\### foo \### + \\## foo #\## + \\# foo \# + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo ###

+ \\

foo ###

+ \\

foo #

+ , output); +} + +test "Example 77" { + const output = try convert(std.testing.allocator, + \\**** + \\## foo + \\**** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo

+ \\
+ , output); +} + +test "Example 78" { + const output = try convert(std.testing.allocator, + \\Foo bar + \\# baz + \\Bar foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo bar

+ \\

baz

+ \\

Bar foo

+ , output); +} + +test "Example 79" { + const output = try convert(std.testing.allocator, + \\## + \\# + \\### ### + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ \\

+ \\

+ , output); +} + +test "Example 80" { + const output = try convert(std.testing.allocator, + \\Foo *bar* + \\========= + \\ + \\Foo *bar* + \\--------- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo bar

+ \\

Foo bar

+ , output); +} + +test "Example 81" { + const output = try convert(std.testing.allocator, + \\Foo *bar + \\baz* + \\==== + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo bar + \\baz

+ , output); +} + +test "Example 82" { + const output = try convert(std.testing.allocator, + \\ Foo *bar + \\baz* + \\==== + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo bar + \\baz

+ , output); +} + +test "Example 83" { + const output = try convert(std.testing.allocator, + \\Foo + \\------------------------- + \\ + \\Foo + \\= + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\

Foo

+ , output); +} + +test "Example 84" { + const output = try convert(std.testing.allocator, + \\ Foo + \\--- + \\ + \\ Foo + \\----- + \\ + \\ Foo + \\ === + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\

Foo

+ \\

Foo

+ , output); +} + +test "Example 85" { + const output = try convert(std.testing.allocator, + \\ Foo + \\ --- + \\ + \\ Foo + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
Foo
+        \\---
+        \\
+        \\Foo
+        \\
+ \\
+ , output); +} + +test "Example 86" { + const output = try convert(std.testing.allocator, + \\Foo + \\ ---- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 87" { + const output = try convert(std.testing.allocator, + \\Foo + \\ --- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\---

+ , output); +} + +test "Example 88" { + const output = try convert(std.testing.allocator, + \\Foo + \\= = + \\ + \\Foo + \\--- - + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\= =

+ \\

Foo

+ \\
+ , output); +} + +test "Example 89" { + const output = try convert(std.testing.allocator, + \\Foo + \\----- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 90" { + const output = try convert(std.testing.allocator, + \\Foo\ + \\---- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo\

+ , output); +} + +test "Example 91" { + const output = try convert(std.testing.allocator, + \\`Foo + \\---- + \\` + \\ + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

`Foo

+ \\

`

+ \\

<a title="a lot

+ \\

of dashes"/>

+ , output); +} + +test "Example 92" { + const output = try convert(std.testing.allocator, + \\> Foo + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Foo

+ \\
+ \\
+ , output); +} + +test "Example 93" { + const output = try convert(std.testing.allocator, + \\> foo + \\bar + \\=== + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo + \\bar + \\===

+ \\
+ , output); +} + +test "Example 94" { + const output = try convert(std.testing.allocator, + \\- Foo + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • Foo
  • + \\
+ \\
+ , output); +} + +test "Example 95" { + const output = try convert(std.testing.allocator, + \\Foo + \\Bar + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\Bar

+ , output); +} + +test "Example 96" { + const output = try convert(std.testing.allocator, + \\--- + \\Foo + \\--- + \\Bar + \\--- + \\Baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Foo

+ \\

Bar

+ \\

Baz

+ , output); +} + +test "Example 97" { + const output = try convert(std.testing.allocator, + \\ + \\==== + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

====

+ , output); +} + +test "Example 98" { + const output = try convert(std.testing.allocator, + \\--- + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ , output); +} + +test "Example 99" { + const output = try convert(std.testing.allocator, + \\- foo + \\----- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
+ \\
+ , output); +} + +test "Example 100" { + const output = try convert(std.testing.allocator, + \\ foo + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\
+ \\
+ , output); +} + +test "Example 101" { + const output = try convert(std.testing.allocator, + \\> foo + \\----- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo

+ \\
+ \\
+ , output); +} + +test "Example 102" { + const output = try convert(std.testing.allocator, + \\\> foo + \\------ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

> foo

+ , output); +} + +test "Example 103" { + const output = try convert(std.testing.allocator, + \\Foo + \\ + \\bar + \\--- + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\

bar

+ \\

baz

+ , output); +} + +test "Example 104" { + const output = try convert(std.testing.allocator, + \\Foo + \\bar + \\ + \\--- + \\ + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\bar

+ \\
+ \\

baz

+ , output); +} + +test "Example 105" { + const output = try convert(std.testing.allocator, + \\Foo + \\bar + \\* * * + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\bar

+ \\
+ \\

baz

+ , output); +} + +test "Example 106" { + const output = try convert(std.testing.allocator, + \\Foo + \\bar + \\\--- + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\bar + \\--- + \\baz

+ , output); +} + +test "Example 107" { + const output = try convert(std.testing.allocator, + \\ a simple + \\ indented code block + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
a simple
+        \\  indented code block
+        \\
+ , output); +} + +test "Example 108" { + const output = try convert(std.testing.allocator, + \\ - foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\

    bar

    + \\
  • + \\
+ , output); +} + +test "Example 109" { + const output = try convert(std.testing.allocator, + \\1. foo + \\ + \\ - bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    foo

    + \\
      + \\
    • bar
    • + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 110" { + const output = try convert(std.testing.allocator, + \\
+ \\ *hi* + \\ + \\ - one + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
<a/>
+        \\*hi*
+        \\
+        \\- one
+        \\
+ , output); +} + +test "Example 111" { + const output = try convert(std.testing.allocator, + \\ chunk1 + \\ + \\ chunk2 + \\ + \\ + \\ + \\ chunk3 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
chunk1
+        \\
+        \\chunk2
+        \\
+        \\
+        \\
+        \\chunk3
+        \\
+ , output); +} + +test "Example 112" { + const output = try convert(std.testing.allocator, + \\ chunk1 + \\ + \\ chunk2 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
chunk1
+        \\  
+        \\  chunk2
+        \\
+ , output); +} + +test "Example 113" { + const output = try convert(std.testing.allocator, + \\Foo + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\bar

+ , output); +} + +test "Example 114" { + const output = try convert(std.testing.allocator, + \\ foo + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\
+ \\

bar

+ , output); +} + +test "Example 115" { + const output = try convert(std.testing.allocator, + \\# Heading + \\ foo + \\Heading + \\------ + \\ foo + \\---- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Heading

+ \\
foo
+        \\
+ \\

Heading

+ \\
foo
+        \\
+ \\
+ , output); +} + +test "Example 116" { + const output = try convert(std.testing.allocator, + \\ foo + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    foo
+        \\bar
+        \\
+ , output); +} + +test "Example 117" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\ foo + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\
+ , output); +} + +test "Example 118" { + const output = try convert(std.testing.allocator, + \\ foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo  
+        \\
+ , output); +} + +test "Example 119" { + const output = try convert(std.testing.allocator, + \\``` + \\< + \\ > + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
<
+        \\ >
+        \\
+ , output); +} + +test "Example 120" { + const output = try convert(std.testing.allocator, + \\~~~ + \\< + \\ > + \\~~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
<
+        \\ >
+        \\
+ , output); +} + +test "Example 121" { + const output = try convert(std.testing.allocator, + \\`` + \\foo + \\`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 122" { + const output = try convert(std.testing.allocator, + \\``` + \\aaa + \\~~~ + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\~~~
+        \\
+ , output); +} + +test "Example 123" { + const output = try convert(std.testing.allocator, + \\~~~ + \\aaa + \\``` + \\~~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\```
+        \\
+ , output); +} + +test "Example 124" { + const output = try convert(std.testing.allocator, + \\```` + \\aaa + \\``` + \\`````` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\```
+        \\
+ , output); +} + +test "Example 125" { + const output = try convert(std.testing.allocator, + \\~~~~ + \\aaa + \\~~~ + \\~~~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\~~~
+        \\
+ , output); +} + +test "Example 126" { + const output = try convert(std.testing.allocator, + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 127" { + const output = try convert(std.testing.allocator, + \\````` + \\ + \\``` + \\aaa + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+        \\```
+        \\aaa
+        \\
+ , output); +} + +test "Example 128" { + const output = try convert(std.testing.allocator, + \\> ``` + \\> aaa + \\ + \\bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
aaa
+        \\
+ \\
+ \\

bbb

+ , output); +} + +test "Example 129" { + const output = try convert(std.testing.allocator, + \\``` + \\ + \\ + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+        \\  
+        \\
+ , output); +} + +test "Example 130" { + const output = try convert(std.testing.allocator, + \\``` + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 131" { + const output = try convert(std.testing.allocator, + \\ ``` + \\ aaa + \\aaa + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\aaa
+        \\
+ , output); +} + +test "Example 132" { + const output = try convert(std.testing.allocator, + \\ ``` + \\aaa + \\ aaa + \\aaa + \\ ``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\aaa
+        \\aaa
+        \\
+ , output); +} + +test "Example 133" { + const output = try convert(std.testing.allocator, + \\ ``` + \\ aaa + \\ aaa + \\ aaa + \\ ``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\ aaa
+        \\aaa
+        \\
+ , output); +} + +test "Example 134" { + const output = try convert(std.testing.allocator, + \\ ``` + \\ aaa + \\ ``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
```
+        \\aaa
+        \\```
+        \\
+ , output); +} + +test "Example 135" { + const output = try convert(std.testing.allocator, + \\``` + \\aaa + \\ ``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\
+ , output); +} + +test "Example 136" { + const output = try convert(std.testing.allocator, + \\ ``` + \\aaa + \\ ``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\
+ , output); +} + +test "Example 137" { + const output = try convert(std.testing.allocator, + \\``` + \\aaa + \\ ``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\    ```
+        \\
+ , output); +} + +test "Example 138" { + const output = try convert(std.testing.allocator, + \\``` ``` + \\aaa + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ \\aaa

+ , output); +} + +test "Example 139" { + const output = try convert(std.testing.allocator, + \\~~~~~~ + \\aaa + \\~~~ ~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\~~~ ~~
+        \\
+ , output); +} + +test "Example 140" { + const output = try convert(std.testing.allocator, + \\foo + \\``` + \\bar + \\``` + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\
bar
+        \\
+ \\

baz

+ , output); +} + +test "Example 141" { + const output = try convert(std.testing.allocator, + \\foo + \\--- + \\~~~ + \\bar + \\~~~ + \\# baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\
bar
+        \\
+ \\

baz

+ , output); +} + +test "Example 142" { + const output = try convert(std.testing.allocator, + \\```ruby + \\def foo(x) + \\ return 3 + \\end + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
def foo(x)
+        \\  return 3
+        \\end
+        \\
+ , output); +} + +test "Example 143" { + const output = try convert(std.testing.allocator, + \\~~~~ ruby startline=3 $%@#$ + \\def foo(x) + \\ return 3 + \\end + \\~~~~~~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
def foo(x)
+        \\  return 3
+        \\end
+        \\
+ , output); +} + +test "Example 144" { + const output = try convert(std.testing.allocator, + \\````; + \\```` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ , output); +} + +test "Example 145" { + const output = try convert(std.testing.allocator, + \\``` aa ``` + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aa + \\foo

+ , output); +} + +test "Example 146" { + const output = try convert(std.testing.allocator, + \\~~~ aa ``` ~~~ + \\foo + \\~~~ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
foo
+        \\
+ , output); +} + +test "Example 147" { + const output = try convert(std.testing.allocator, + \\``` + \\``` aaa + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
``` aaa
+        \\
+ , output); +} + +test "Example 148" { + const output = try convert(std.testing.allocator, + \\
+ \\
+        \\**Hello**,
+        \\
+        \\_world_.
+        \\
+ \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+        \\**Hello**,
+        \\

world. + \\

+ \\
+ , output); +} + +test "Example 149" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\ + \\ + \\
+ \\ hi + \\
+ \\ + \\okay. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\ + \\ + \\ + \\
+ \\ hi + \\
+ \\

okay.

+ , output); +} + +test "Example 150" { + const output = try convert(std.testing.allocator, + \\
+ \\ *hello* + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\ *hello* + \\ + , output); +} + +test "Example 151" { + const output = try convert(std.testing.allocator, + \\
+ \\*foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\*foo* + , output); +} + +test "Example 152" { + const output = try convert(std.testing.allocator, + \\
+ \\ + \\*Markdown* + \\ + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Markdown

+ \\
+ , output); +} + +test "Example 153" { + const output = try convert(std.testing.allocator, + \\
+ \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ , output); +} + +test "Example 154" { + const output = try convert(std.testing.allocator, + \\
+ \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ , output); +} + +test "Example 155" { + const output = try convert(std.testing.allocator, + \\
+ \\*foo* + \\ + \\*bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\*foo* + \\

bar

+ , output); +} + +test "Example 156" { + const output = try convert(std.testing.allocator, + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
*foo*
+ , output); +} + +test "Example 160" { + const output = try convert(std.testing.allocator, + \\
+ \\foo + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\foo + \\
+ , output); +} + +test "Example 161" { + const output = try convert(std.testing.allocator, + \\
+ \\``` c + \\int x = 33; + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\``` c + \\int x = 33; + \\``` + , output); +} + +test "Example 162" { + const output = try convert(std.testing.allocator, + \\ + \\*bar* + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\*bar* + \\ + , output); +} + +test "Example 163" { + const output = try convert(std.testing.allocator, + \\ + \\*bar* + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\*bar* + \\ + , output); +} + +test "Example 164" { + const output = try convert(std.testing.allocator, + \\ + \\*bar* + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\*bar* + \\ + , output); +} + +test "Example 165" { + const output = try convert(std.testing.allocator, + \\ + \\*bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\*bar* + , output); +} + +test "Example 166" { + const output = try convert(std.testing.allocator, + \\ + \\*foo* + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\*foo* + \\ + , output); +} + +test "Example 167" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\*foo* + \\ + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\

foo

+ \\
+ , output); +} + +test "Example 168" { + const output = try convert(std.testing.allocator, + \\*foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 169" { + const output = try convert(std.testing.allocator, + \\

+        \\import Text.HTML.TagSoup
+        \\
+        \\main :: IO ()
+        \\main = print $ parseTags tags
+        \\
+ \\okay + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+        \\import Text.HTML.TagSoup
+        \\
+        \\main :: IO ()
+        \\main = print $ parseTags tags
+        \\
+ \\

okay

+ , output); +} + +test "Example 170" { + const output = try convert(std.testing.allocator, + \\ + \\okay + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\

okay

+ , output); +} + +test "Example 171" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 172" { + const output = try convert(std.testing.allocator, + \\ + \\okay + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\

okay

+ , output); +} + +test "Example 173" { + const output = try convert(std.testing.allocator, + \\ + \\*foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\

foo

+ , output); +} + +test "Example 177" { + const output = try convert(std.testing.allocator, + \\*bar* + \\*baz* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\*bar* + \\

baz

+ , output); +} + +test "Example 178" { + const output = try convert(std.testing.allocator, + \\1. *bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\1. *bar* + , output); +} + +test "Example 179" { + const output = try convert(std.testing.allocator, + \\ + \\okay + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\

okay

+ , output); +} + +test "Example 180" { + const output = try convert(std.testing.allocator, + \\'; + \\ + \\?> + \\okay + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\'; + \\ + \\?> + \\

okay

+ , output); +} + +test "Example 181" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + , output); +} + +test "Example 182" { + const output = try convert(std.testing.allocator, + \\ + \\okay + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\

okay

+ , output); +} + +test "Example 183" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\
<!-- foo -->
+        \\
+ , output); +} + +test "Example 184" { + const output = try convert(std.testing.allocator, + \\
+ \\ + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
<div>
+        \\
+ , output); +} + +test "Example 185" { + const output = try convert(std.testing.allocator, + \\Foo + \\
+ \\bar + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\
+ \\bar + \\
+ , output); +} + +test "Example 186" { + const output = try convert(std.testing.allocator, + \\
+ \\bar + \\
+ \\*foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\bar + \\
+ \\*foo* + , output); +} + +test "Example 187" { + const output = try convert(std.testing.allocator, + \\Foo + \\ + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\ + \\baz

+ , output); +} + +test "Example 188" { + const output = try convert(std.testing.allocator, + \\
+ \\ + \\*Emphasized* text. + \\ + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Emphasized text.

+ \\
+ , output); +} + +test "Example 189" { + const output = try convert(std.testing.allocator, + \\
+ \\*Emphasized* text. + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\*Emphasized* text. + \\
+ , output); +} + +test "Example 190" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\ + \\ + \\ + \\ + \\ + \\ + \\
+ \\Hi + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\ + \\ + \\ + \\
+ \\Hi + \\
+ , output); +} + +test "Example 191" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\ + \\ + \\ + \\ + \\ + \\ + \\
+ \\ Hi + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\ + \\ + \\
<td>
+        \\  Hi
+        \\</td>
+        \\
+ \\ + \\
+ , output); +} + +test "Example 192" { + const output = try convert(std.testing.allocator, + \\[foo]: /url "title" + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 193" { + const output = try convert(std.testing.allocator, + \\ [foo]: + \\ /url + \\ 'the title' + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 194" { + const output = try convert(std.testing.allocator, + \\[Foo*bar\]]:my_(url) 'title (with parens)' + \\ + \\[Foo*bar\]] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo*bar]

+ , output); +} + +test "Example 195" { + const output = try convert(std.testing.allocator, + \\[Foo bar]: + \\ + \\'title' + \\ + \\[Foo bar] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo bar

+ , output); +} + +test "Example 196" { + const output = try convert(std.testing.allocator, + \\[foo]: /url ' + \\title + \\line1 + \\line2 + \\' + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 197" { + const output = try convert(std.testing.allocator, + \\[foo]: /url 'title + \\ + \\with blank line' + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]: /url 'title

+ \\

with blank line'

+ \\

[foo]

+ , output); +} + +test "Example 198" { + const output = try convert(std.testing.allocator, + \\[foo]: + \\/url + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 199" { + const output = try convert(std.testing.allocator, + \\[foo]: + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]:

+ \\

[foo]

+ , output); +} + +test "Example 200" { + const output = try convert(std.testing.allocator, + \\[foo]: <> + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 201" { + const output = try convert(std.testing.allocator, + \\[foo]: (baz) + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]: (baz)

+ \\

[foo]

+ , output); +} + +test "Example 202" { + const output = try convert(std.testing.allocator, + \\[foo]: /url\bar\*baz "foo\"bar\baz" + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 203" { + const output = try convert(std.testing.allocator, + \\[foo] + \\ + \\[foo]: url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 204" { + const output = try convert(std.testing.allocator, + \\[foo] + \\ + \\[foo]: first + \\[foo]: second + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 205" { + const output = try convert(std.testing.allocator, + \\[FOO]: /url + \\ + \\[Foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 206" { + const output = try convert(std.testing.allocator, + \\[ΑΓΩ]: /φου + \\ + \\[αγω] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

αγω

+ , output); +} + +test "Example 207" { + const output = try convert(std.testing.allocator, + \\[foo]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings("", output); +} + +test "Example 208" { + const output = try convert(std.testing.allocator, + \\[ + \\foo + \\]: /url + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

bar

+ , output); +} + +test "Example 209" { + const output = try convert(std.testing.allocator, + \\[foo]: /url "title" ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]: /url "title" ok

+ , output); +} + +test "Example 210" { + const output = try convert(std.testing.allocator, + \\[foo]: /url + \\"title" ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

"title" ok

+ , output); +} + +test "Example 211" { + const output = try convert(std.testing.allocator, + \\ [foo]: /url "title" + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
[foo]: /url "title"
+        \\
+ \\

[foo]

+ , output); +} + +test "Example 212" { + const output = try convert(std.testing.allocator, + \\``` + \\[foo]: /url + \\``` + \\ + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
[foo]: /url
+        \\
+ \\

[foo]

+ , output); +} + +test "Example 213" { + const output = try convert(std.testing.allocator, + \\Foo + \\[bar]: /baz + \\ + \\[bar] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo + \\[bar]: /baz

+ \\

[bar]

+ , output); +} + +test "Example 214" { + const output = try convert(std.testing.allocator, + \\# [Foo] + \\[foo]: /url + \\> bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\
+ \\

bar

+ \\
+ , output); +} + +test "Example 215" { + const output = try convert(std.testing.allocator, + \\[foo]: /url + \\bar + \\=== + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

bar

+ \\

foo

+ , output); +} + +test "Example 216" { + const output = try convert(std.testing.allocator, + \\[foo]: /url + \\=== + \\[foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

=== + \\foo

+ , output); +} + +test "Example 217" { + const output = try convert(std.testing.allocator, + \\[foo]: /foo-url "foo" + \\[bar]: /bar-url + \\ "bar" + \\[baz]: /baz-url + \\ + \\[foo], + \\[bar], + \\[baz] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo, + \\bar, + \\baz

+ , output); +} + +test "Example 218" { + const output = try convert(std.testing.allocator, + \\[foo] + \\ + \\> [foo]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\
+ \\
+ , output); +} + +test "Example 219" { + const output = try convert(std.testing.allocator, + \\aaa + \\ + \\bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa

+ \\

bbb

+ , output); +} + +test "Example 220" { + const output = try convert(std.testing.allocator, + \\aaa + \\bbb + \\ + \\ccc + \\ddd + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa + \\bbb

+ \\

ccc + \\ddd

+ , output); +} + +test "Example 221" { + const output = try convert(std.testing.allocator, + \\aaa + \\ + \\ + \\bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa

+ \\

bbb

+ , output); +} + +test "Example 222" { + const output = try convert(std.testing.allocator, + \\ aaa + \\ bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa + \\bbb

+ , output); +} + +test "Example 223" { + const output = try convert(std.testing.allocator, + \\aaa + \\ bbb + \\ ccc + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa + \\bbb + \\ccc

+ , output); +} + +test "Example 224" { + const output = try convert(std.testing.allocator, + \\ aaa + \\bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa + \\bbb

+ , output); +} + +test "Example 225" { + const output = try convert(std.testing.allocator, + \\ aaa + \\bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
aaa
+        \\
+ \\

bbb

+ , output); +} + +test "Example 226" { + const output = try convert(std.testing.allocator, + \\aaa + \\bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa
+ \\bbb

+ , output); +} + +test "Example 227" { + const output = try convert(std.testing.allocator, + \\ + \\ + \\aaa + \\ + \\ + \\# aaa + \\ + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aaa

+ \\

aaa

+ , output); +} + +test "Example 228" { + const output = try convert(std.testing.allocator, + \\> # Foo + \\> bar + \\> baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Foo

+ \\

bar + \\baz

+ \\
+ , output); +} + +test "Example 229" { + const output = try convert(std.testing.allocator, + \\># Foo + \\>bar + \\> baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Foo

+ \\

bar + \\baz

+ \\
+ , output); +} + +test "Example 230" { + const output = try convert(std.testing.allocator, + \\ > # Foo + \\ > bar + \\ > baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Foo

+ \\

bar + \\baz

+ \\
+ , output); +} + +test "Example 231" { + const output = try convert(std.testing.allocator, + \\ > # Foo + \\ > bar + \\ > baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
> # Foo
+        \\> bar
+        \\> baz
+        \\
+ , output); +} + +test "Example 232" { + const output = try convert(std.testing.allocator, + \\> # Foo + \\> bar + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

Foo

+ \\

bar + \\baz

+ \\
+ , output); +} + +test "Example 233" { + const output = try convert(std.testing.allocator, + \\> bar + \\baz + \\> foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

bar + \\baz + \\foo

+ \\
+ , output); +} + +test "Example 234" { + const output = try convert(std.testing.allocator, + \\> foo + \\--- + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo

+ \\
+ \\
+ , output); +} + +test "Example 235" { + const output = try convert(std.testing.allocator, + \\> - foo + \\- bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
    + \\
  • foo
  • + \\
+ \\
+ \\
    + \\
  • bar
  • + \\
+ , output); +} + +test "Example 236" { + const output = try convert(std.testing.allocator, + \\> foo + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
foo
+        \\
+ \\
+ \\
bar
+        \\
+ , output); +} + +test "Example 237" { + const output = try convert(std.testing.allocator, + \\> ``` + \\foo + \\``` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
+ \\

foo

+ \\
+ , output); +} + +test "Example 238" { + const output = try convert(std.testing.allocator, + \\> foo + \\ - bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo + \\- bar

+ \\
+ , output); +} + +test "Example 239" { + const output = try convert(std.testing.allocator, + \\> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ , output); +} + +test "Example 240" { + const output = try convert(std.testing.allocator, + \\> + \\> + \\> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ , output); +} + +test "Example 241" { + const output = try convert(std.testing.allocator, + \\> + \\> foo + \\> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo

+ \\
+ , output); +} + +test "Example 242" { + const output = try convert(std.testing.allocator, + \\> foo + \\ + \\> bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo

+ \\
+ \\
+ \\

bar

+ \\
+ , output); +} + +test "Example 243" { + const output = try convert(std.testing.allocator, + \\> foo + \\> bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo + \\bar

+ \\
+ , output); +} + +test "Example 244" { + const output = try convert(std.testing.allocator, + \\> foo + \\> + \\> bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

foo

+ \\

bar

+ \\
+ , output); +} + +test "Example 245" { + const output = try convert(std.testing.allocator, + \\foo + \\> bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\
+ \\

bar

+ \\
+ , output); +} + +test "Example 246" { + const output = try convert(std.testing.allocator, + \\> aaa + \\*** + \\> bbb + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

aaa

+ \\
+ \\
+ \\
+ \\

bbb

+ \\
+ , output); +} + +test "Example 247" { + const output = try convert(std.testing.allocator, + \\> bar + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

bar + \\baz

+ \\
+ , output); +} + +test "Example 248" { + const output = try convert(std.testing.allocator, + \\> bar + \\ + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

bar

+ \\
+ \\

baz

+ , output); +} + +test "Example 249" { + const output = try convert(std.testing.allocator, + \\> bar + \\> + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\

bar

+ \\
+ \\

baz

+ , output); +} + +test "Example 250" { + const output = try convert(std.testing.allocator, + \\> > > foo + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
+ \\

foo + \\bar

+ \\
+ \\
+ \\
+ , output); +} + +test "Example 251" { + const output = try convert(std.testing.allocator, + \\>>> foo + \\> bar + \\>>baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
+ \\

foo + \\bar + \\baz

+ \\
+ \\
+ \\
+ , output); +} + +test "Example 252" { + const output = try convert(std.testing.allocator, + \\> code + \\ + \\> not code + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
code
+        \\
+ \\
+ \\
+ \\

not code

+ \\
+ , output); +} + +test "Example 253" { + const output = try convert(std.testing.allocator, + \\A paragraph + \\with two lines. + \\ + \\ indented code + \\ + \\> A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

A paragraph + \\with two lines.

+ \\
indented code
+        \\
+ \\
+ \\

A block quote.

+ \\
+ , output); +} + +test "Example 254" { + const output = try convert(std.testing.allocator, + \\1. A paragraph + \\ with two lines. + \\ + \\ indented code + \\ + \\ > A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    A paragraph + \\with two lines.

    + \\
    indented code
    +        \\
    + \\
    + \\

    A block quote.

    + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 255" { + const output = try convert(std.testing.allocator, + \\- one + \\ + \\ two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • one
  • + \\
+ \\

two

+ , output); +} + +test "Example 256" { + const output = try convert(std.testing.allocator, + \\- one + \\ + \\ two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    one

    + \\

    two

    + \\
  • + \\
+ , output); +} + +test "Example 257" { + const output = try convert(std.testing.allocator, + \\ - one + \\ + \\ two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • one
  • + \\
+ \\
 two
+        \\
+ , output); +} + +test "Example 258" { + const output = try convert(std.testing.allocator, + \\ - one + \\ + \\ two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    one

    + \\

    two

    + \\
  • + \\
+ , output); +} + +test "Example 259" { + const output = try convert(std.testing.allocator, + \\ > > 1. one + \\>> + \\>> two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
    + \\
  1. + \\

    one

    + \\

    two

    + \\
  2. + \\
+ \\
+ \\
+ , output); +} + +test "Example 260" { + const output = try convert(std.testing.allocator, + \\>>- one + \\>> + \\ > > two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
+ \\
    + \\
  • one
  • + \\
+ \\

two

+ \\
+ \\
+ , output); +} + +test "Example 261" { + const output = try convert(std.testing.allocator, + \\-one + \\ + \\2.two + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

-one

+ \\

2.two

+ , output); +} + +test "Example 262" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\

    bar

    + \\
  • + \\
+ , output); +} + +test "Example 263" { + const output = try convert(std.testing.allocator, + \\1. foo + \\ + \\ ``` + \\ bar + \\ ``` + \\ + \\ baz + \\ + \\ > bam + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    foo

    + \\
    bar
    +        \\
    + \\

    baz

    + \\
    + \\

    bam

    + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 264" { + const output = try convert(std.testing.allocator, + \\- Foo + \\ + \\ bar + \\ + \\ + \\ baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    Foo

    + \\
    bar
    +        \\
    +        \\
    +        \\baz
    +        \\
    + \\
  • + \\
+ , output); +} + +test "Example 265" { + const output = try convert(std.testing.allocator, + \\123456789. ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. ok
  2. + \\
+ , output); +} + +test "Example 266" { + const output = try convert(std.testing.allocator, + \\1234567890. not ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

1234567890. not ok

+ , output); +} + +test "Example 267" { + const output = try convert(std.testing.allocator, + \\0. ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. ok
  2. + \\
+ , output); +} + +test "Example 268" { + const output = try convert(std.testing.allocator, + \\003. ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. ok
  2. + \\
+ , output); +} + +test "Example 269" { + const output = try convert(std.testing.allocator, + \\-1. not ok + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

-1. not ok

+ , output); +} + +test "Example 270" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\
    bar
    +        \\
    + \\
  • + \\
+ , output); +} + +test "Example 271" { + const output = try convert(std.testing.allocator, + \\ 10. foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    foo

    + \\
    bar
    +        \\
    + \\
  2. + \\
+ , output); +} + +test "Example 272" { + const output = try convert(std.testing.allocator, + \\ indented code + \\ + \\paragraph + \\ + \\ more code + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
indented code
+        \\
+ \\

paragraph

+ \\
more code
+        \\
+ , output); +} + +test "Example 273" { + const output = try convert(std.testing.allocator, + \\1. indented code + \\ + \\ paragraph + \\ + \\ more code + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\
    indented code
    +        \\
    + \\

    paragraph

    + \\
    more code
    +        \\
    + \\
  2. + \\
+ , output); +} + +test "Example 274" { + const output = try convert(std.testing.allocator, + \\1. indented code + \\ + \\ paragraph + \\ + \\ more code + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\
     indented code
    +        \\
    + \\

    paragraph

    + \\
    more code
    +        \\
    + \\
  2. + \\
+ , output); +} + +test "Example 275" { + const output = try convert(std.testing.allocator, + \\ foo + \\ + \\bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ \\

bar

+ , output); +} + +test "Example 276" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
+ \\

bar

+ , output); +} + +test "Example 277" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\

    bar

    + \\
  • + \\
+ , output); +} + +test "Example 278" { + const output = try convert(std.testing.allocator, + \\- + \\ foo + \\- + \\ ``` + \\ bar + \\ ``` + \\- + \\ baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
  • + \\
    bar
    +        \\
    + \\
  • + \\
  • + \\
    baz
    +        \\
    + \\
  • + \\
+ , output); +} + +test "Example 279" { + const output = try convert(std.testing.allocator, + \\- + \\ foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
+ , output); +} + +test "Example 280" { + const output = try convert(std.testing.allocator, + \\- + \\ + \\ foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\
+ \\

foo

+ , output); +} + +test "Example 281" { + const output = try convert(std.testing.allocator, + \\- foo + \\- + \\- bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
  • + \\
  • bar
  • + \\
+ , output); +} + +test "Example 282" { + const output = try convert(std.testing.allocator, + \\- foo + \\- + \\- bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
  • + \\
  • bar
  • + \\
+ , output); +} + +test "Example 283" { + const output = try convert(std.testing.allocator, + \\1. foo + \\2. + \\3. bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. foo
  2. + \\
  3. + \\
  4. bar
  5. + \\
+ , output); +} + +test "Example 284" { + const output = try convert(std.testing.allocator, + \\* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\
+ , output); +} + +test "Example 285" { + const output = try convert(std.testing.allocator, + \\foo + \\* + \\ + \\foo + \\1. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\*

+ \\

foo + \\1.

+ , output); +} + +test "Example 286" { + const output = try convert(std.testing.allocator, + \\ 1. A paragraph + \\ with two lines. + \\ + \\ indented code + \\ + \\ > A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    A paragraph + \\with two lines.

    + \\
    indented code
    +        \\
    + \\
    + \\

    A block quote.

    + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 287" { + const output = try convert(std.testing.allocator, + \\ 1. A paragraph + \\ with two lines. + \\ + \\ indented code + \\ + \\ > A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    A paragraph + \\with two lines.

    + \\
    indented code
    +        \\
    + \\
    + \\

    A block quote.

    + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 288" { + const output = try convert(std.testing.allocator, + \\ 1. A paragraph + \\ with two lines. + \\ + \\ indented code + \\ + \\ > A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    A paragraph + \\with two lines.

    + \\
    indented code
    +        \\
    + \\
    + \\

    A block quote.

    + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 289" { + const output = try convert(std.testing.allocator, + \\ 1. A paragraph + \\ with two lines. + \\ + \\ indented code + \\ + \\ > A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
1.  A paragraph
+        \\    with two lines.
+        \\
+        \\        indented code
+        \\
+        \\    > A block quote.
+        \\
+ , output); +} + +test "Example 290" { + const output = try convert(std.testing.allocator, + \\ 1. A paragraph + \\with two lines. + \\ + \\ indented code + \\ + \\ > A block quote. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    A paragraph + \\with two lines.

    + \\
    indented code
    +        \\
    + \\
    + \\

    A block quote.

    + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 291" { + const output = try convert(std.testing.allocator, + \\ 1. A paragraph + \\ with two lines. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. A paragraph + \\with two lines.
  2. + \\
+ , output); +} + +test "Example 292" { + const output = try convert(std.testing.allocator, + \\> 1. > Blockquote + \\continued here. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
    + \\
  1. + \\
    + \\

    Blockquote + \\continued here.

    + \\
    + \\
  2. + \\
+ \\
+ , output); +} + +test "Example 293" { + const output = try convert(std.testing.allocator, + \\> 1. > Blockquote + \\> continued here. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
+ \\
    + \\
  1. + \\
    + \\

    Blockquote + \\continued here.

    + \\
    + \\
  2. + \\
+ \\
+ , output); +} + +test "Example 294" { + const output = try convert(std.testing.allocator, + \\- foo + \\ - bar + \\ - baz + \\ - boo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo + \\
      + \\
    • bar + \\
        + \\
      • baz + \\
          + \\
        • boo
        • + \\
        + \\
      • + \\
      + \\
    • + \\
    + \\
  • + \\
+ , output); +} + +test "Example 295" { + const output = try convert(std.testing.allocator, + \\- foo + \\ - bar + \\ - baz + \\ - boo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
  • bar
  • + \\
  • baz
  • + \\
  • boo
  • + \\
+ , output); +} + +test "Example 296" { + const output = try convert(std.testing.allocator, + \\10) foo + \\ - bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. foo + \\
      + \\
    • bar
    • + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 297" { + const output = try convert(std.testing.allocator, + \\10) foo + \\ - bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. foo
  2. + \\
+ \\
    + \\
  • bar
  • + \\
+ , output); +} + +test "Example 298" { + const output = try convert(std.testing.allocator, + \\- - foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\
      + \\
    • foo
    • + \\
    + \\
  • + \\
+ , output); +} + +test "Example 299" { + const output = try convert(std.testing.allocator, + \\1. - 2. foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\
      + \\
    • + \\
        + \\
      1. foo
      2. + \\
      + \\
    • + \\
    + \\
  2. + \\
+ , output); +} + +test "Example 300" { + const output = try convert(std.testing.allocator, + \\- # Foo + \\- Bar + \\ --- + \\ baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    Foo

    + \\
  • + \\
  • + \\

    Bar

    + \\baz
  • + \\
+ , output); +} + +test "Example 301" { + const output = try convert(std.testing.allocator, + \\- foo + \\- bar + \\+ baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
  • bar
  • + \\
+ \\
    + \\
  • baz
  • + \\
+ , output); +} + +test "Example 302" { + const output = try convert(std.testing.allocator, + \\1. foo + \\2. bar + \\3) baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. foo
  2. + \\
  3. bar
  4. + \\
+ \\
    + \\
  1. baz
  2. + \\
+ , output); +} + +test "Example 303" { + const output = try convert(std.testing.allocator, + \\Foo + \\- bar + \\- baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ \\
    + \\
  • bar
  • + \\
  • baz
  • + \\
+ , output); +} + +test "Example 304" { + const output = try convert(std.testing.allocator, + \\The number of windows in my house is + \\14. The number of doors is 6. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

The number of windows in my house is + \\14. The number of doors is 6.

+ , output); +} + +test "Example 305" { + const output = try convert(std.testing.allocator, + \\The number of windows in my house is + \\1. The number of doors is 6. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

The number of windows in my house is

+ \\
    + \\
  1. The number of doors is 6.
  2. + \\
+ , output); +} + +test "Example 306" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\- bar + \\ + \\ + \\- baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\
  • + \\
  • + \\

    bar

    + \\
  • + \\
  • + \\

    baz

    + \\
  • + \\
+ , output); +} + +test "Example 307" { + const output = try convert(std.testing.allocator, + \\- foo + \\ - bar + \\ - baz + \\ + \\ + \\ bim + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo + \\
      + \\
    • bar + \\
        + \\
      • + \\

        baz

        + \\

        bim

        + \\
      • + \\
      + \\
    • + \\
    + \\
  • + \\
+ , output); +} + +test "Example 308" { + const output = try convert(std.testing.allocator, + \\- foo + \\- bar + \\ + \\ + \\ + \\- baz + \\- bim + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • foo
  • + \\
  • bar
  • + \\
+ \\ + \\
    + \\
  • baz
  • + \\
  • bim
  • + \\
+ , output); +} + +test "Example 309" { + const output = try convert(std.testing.allocator, + \\- foo + \\ + \\ notcode + \\ + \\- foo + \\ + \\ + \\ + \\ code + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\

    notcode

    + \\
  • + \\
  • + \\

    foo

    + \\
  • + \\
+ \\ + \\
code
+        \\
+ , output); +} + +test "Example 310" { + const output = try convert(std.testing.allocator, + \\- a + \\ - b + \\ - c + \\ - d + \\ - e + \\ - f + \\- g + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a
  • + \\
  • b
  • + \\
  • c
  • + \\
  • d
  • + \\
  • e
  • + \\
  • f
  • + \\
  • g
  • + \\
+ , output); +} + +test "Example 311" { + const output = try convert(std.testing.allocator, + \\1. a + \\ + \\ 2. b + \\ + \\ 3. c + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    a

    + \\
  2. + \\
  3. + \\

    b

    + \\
  4. + \\
  5. + \\

    c

    + \\
  6. + \\
+ , output); +} + +test "Example 312" { + const output = try convert(std.testing.allocator, + \\- a + \\ - b + \\ - c + \\ - d + \\ - e + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a
  • + \\
  • b
  • + \\
  • c
  • + \\
  • d + \\- e
  • + \\
+ , output); +} + +test "Example 313" { + const output = try convert(std.testing.allocator, + \\1. a + \\ + \\ 2. b + \\ + \\ 3. c + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\

    a

    + \\
  2. + \\
  3. + \\

    b

    + \\
  4. + \\
+ \\
3. c
+        \\
+ , output); +} + +test "Example 314" { + const output = try convert(std.testing.allocator, + \\- a + \\- b + \\ + \\- c + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    a

    + \\
  • + \\
  • + \\

    b

    + \\
  • + \\
  • + \\

    c

    + \\
  • + \\
+ , output); +} + +test "Example 315" { + const output = try convert(std.testing.allocator, + \\* a + \\* + \\ + \\* c + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    a

    + \\
  • + \\
  • + \\
  • + \\

    c

    + \\
  • + \\
+ , output); +} + +test "Example 316" { + const output = try convert(std.testing.allocator, + \\- a + \\- b + \\ + \\ c + \\- d + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    a

    + \\
  • + \\
  • + \\

    b

    + \\

    c

    + \\
  • + \\
  • + \\

    d

    + \\
  • + \\
+ , output); +} + +test "Example 317" { + const output = try convert(std.testing.allocator, + \\- a + \\- b + \\ + \\ [ref]: /url + \\- d + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    a

    + \\
  • + \\
  • + \\

    b

    + \\
  • + \\
  • + \\

    d

    + \\
  • + \\
+ , output); +} + +test "Example 318" { + const output = try convert(std.testing.allocator, + \\- a + \\- ``` + \\ b + \\ + \\ + \\ ``` + \\- c + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a
  • + \\
  • + \\
    b
    +        \\
    +        \\
    +        \\
    + \\
  • + \\
  • c
  • + \\
+ , output); +} + +test "Example 319" { + const output = try convert(std.testing.allocator, + \\- a + \\ - b + \\ + \\ c + \\- d + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a + \\
      + \\
    • + \\

      b

      + \\

      c

      + \\
    • + \\
    + \\
  • + \\
  • d
  • + \\
+ , output); +} + +test "Example 320" { + const output = try convert(std.testing.allocator, + \\* a + \\ > b + \\ > + \\* c + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a + \\
    + \\

    b

    + \\
    + \\
  • + \\
  • c
  • + \\
+ , output); +} + +test "Example 321" { + const output = try convert(std.testing.allocator, + \\- a + \\ > b + \\ ``` + \\ c + \\ ``` + \\- d + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a + \\
    + \\

    b

    + \\
    + \\
    c
    +        \\
    + \\
  • + \\
  • d
  • + \\
+ , output); +} + +test "Example 322" { + const output = try convert(std.testing.allocator, + \\- a + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a
  • + \\
+ , output); +} + +test "Example 323" { + const output = try convert(std.testing.allocator, + \\- a + \\ - b + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • a + \\
      + \\
    • b
    • + \\
    + \\
  • + \\
+ , output); +} + +test "Example 324" { + const output = try convert(std.testing.allocator, + \\1. ``` + \\ foo + \\ ``` + \\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  1. + \\
    foo
    +        \\
    + \\

    bar

    + \\
  2. + \\
+ , output); +} + +test "Example 325" { + const output = try convert(std.testing.allocator, + \\* foo + \\ * bar + \\ + \\ baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    foo

    + \\
      + \\
    • bar
    • + \\
    + \\

    baz

    + \\
  • + \\
+ , output); +} + +test "Example 326" { + const output = try convert(std.testing.allocator, + \\- a + \\ - b + \\ - c + \\ + \\- d + \\ - e + \\ - f + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\
    + \\
  • + \\

    a

    + \\
      + \\
    • b
    • + \\
    • c
    • + \\
    + \\
  • + \\
  • + \\

    d

    + \\
      + \\
    • e
    • + \\
    • f
    • + \\
    + \\
  • + \\
+ , output); +} + +test "Example 327" { + const output = try convert(std.testing.allocator, + \\`hi`lo` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

hilo`

+ , output); +} + +test "Example 328" { + const output = try convert(std.testing.allocator, + \\`foo` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 329" { + const output = try convert(std.testing.allocator, + \\`` foo ` bar `` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo ` bar

+ , output); +} + +test "Example 330" { + const output = try convert(std.testing.allocator, + \\` `` ` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

``

+ , output); +} + +test "Example 331" { + const output = try convert(std.testing.allocator, + \\` `` ` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

``

+ , output); +} + +test "Example 332" { + const output = try convert(std.testing.allocator, + \\` a` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a

+ , output); +} + +test "Example 333" { + const output = try convert(std.testing.allocator, + \\` b ` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

 b 

+ , output); +} + +test "Example 334" { + const output = try convert(std.testing.allocator, + \\` ` + \\` ` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

  + \\

+ , output); +} + +test "Example 335" { + const output = try convert(std.testing.allocator, + \\`` + \\foo + \\bar + \\baz + \\`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 336" { + const output = try convert(std.testing.allocator, + \\`` + \\foo + \\`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 337" { + const output = try convert(std.testing.allocator, + \\`foo bar + \\baz` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 338" { + const output = try convert(std.testing.allocator, + \\`foo\`bar` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo\bar`

+ , output); +} + +test "Example 339" { + const output = try convert(std.testing.allocator, + \\``foo`bar`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo`bar

+ , output); +} + +test "Example 340" { + const output = try convert(std.testing.allocator, + \\` foo `` bar ` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo `` bar

+ , output); +} + +test "Example 341" { + const output = try convert(std.testing.allocator, + \\*foo`*` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo*

+ , output); +} + +test "Example 342" { + const output = try convert(std.testing.allocator, + \\[not a `link](/foo`) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[not a link](/foo)

+ , output); +} + +test "Example 343" { + const output = try convert(std.testing.allocator, + \\`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<a href="">`

+ , output); +} + +test "Example 344" { + const output = try convert(std.testing.allocator, + \\
` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

`

+ , output); +} + +test "Example 345" { + const output = try convert(std.testing.allocator, + \\`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<https://foo.bar.baz>`

+ , output); +} + +test "Example 346" { + const output = try convert(std.testing.allocator, + \\` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

https://foo.bar.`baz`

+ , output); +} + +test "Example 347" { + const output = try convert(std.testing.allocator, + \\```foo`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

```foo``

+ , output); +} + +test "Example 348" { + const output = try convert(std.testing.allocator, + \\`foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

`foo

+ , output); +} + +test "Example 349" { + const output = try convert(std.testing.allocator, + \\`foo``bar`` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

`foobar

+ , output); +} + +test "Example 350" { + const output = try convert(std.testing.allocator, + \\*foo bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 351" { + const output = try convert(std.testing.allocator, + \\a * foo bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a * foo bar*

+ , output); +} + +test "Example 352" { + const output = try convert(std.testing.allocator, + \\a*"foo"* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a*"foo"*

+ , output); +} + +test "Example 353" { + const output = try convert(std.testing.allocator, + \\* a * + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

* a *

+ , output); +} + +test "Example 354" { + const output = try convert(std.testing.allocator, + \\*$*alpha. + \\ + \\*£*bravo. + \\ + \\*€*charlie. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*$*alpha.

+ \\

*£*bravo.

+ \\

*€*charlie.

+ , output); +} + +test "Example 355" { + const output = try convert(std.testing.allocator, + \\foo*bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobar

+ , output); +} + +test "Example 356" { + const output = try convert(std.testing.allocator, + \\5*6*78 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

5678

+ , output); +} + +test "Example 357" { + const output = try convert(std.testing.allocator, + \\_foo bar_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 358" { + const output = try convert(std.testing.allocator, + \\_ foo bar_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_ foo bar_

+ , output); +} + +test "Example 359" { + const output = try convert(std.testing.allocator, + \\a_"foo"_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a_"foo"_

+ , output); +} + +test "Example 360" { + const output = try convert(std.testing.allocator, + \\foo_bar_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo_bar_

+ , output); +} + +test "Example 361" { + const output = try convert(std.testing.allocator, + \\5_6_78 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

5_6_78

+ , output); +} + +test "Example 362" { + const output = try convert(std.testing.allocator, + \\пристаням_стремятся_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

пристаням_стремятся_

+ , output); +} + +test "Example 363" { + const output = try convert(std.testing.allocator, + \\aa_"bb"_cc + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

aa_"bb"_cc

+ , output); +} + +test "Example 364" { + const output = try convert(std.testing.allocator, + \\foo-_(bar)_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo-(bar)

+ , output); +} + +test "Example 365" { + const output = try convert(std.testing.allocator, + \\_foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_foo*

+ , output); +} + +test "Example 366" { + const output = try convert(std.testing.allocator, + \\*foo bar * + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo bar *

+ , output); +} + +test "Example 367" { + const output = try convert(std.testing.allocator, + \\*foo bar + \\* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo bar + \\*

+ , output); +} + +test "Example 368" { + const output = try convert(std.testing.allocator, + \\*(*foo) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*(*foo)

+ , output); +} + +test "Example 369" { + const output = try convert(std.testing.allocator, + \\*(*foo*)* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

(foo)

+ , output); +} + +test "Example 370" { + const output = try convert(std.testing.allocator, + \\*foo*bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobar

+ , output); +} + +test "Example 371" { + const output = try convert(std.testing.allocator, + \\_foo bar _ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_foo bar _

+ , output); +} + +test "Example 372" { + const output = try convert(std.testing.allocator, + \\_(_foo) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_(_foo)

+ , output); +} + +test "Example 373" { + const output = try convert(std.testing.allocator, + \\_(_foo_)_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

(foo)

+ , output); +} + +test "Example 374" { + const output = try convert(std.testing.allocator, + \\_foo_bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_foo_bar

+ , output); +} + +test "Example 375" { + const output = try convert(std.testing.allocator, + \\_пристаням_стремятся + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_пристаням_стремятся

+ , output); +} + +test "Example 376" { + const output = try convert(std.testing.allocator, + \\_foo_bar_baz_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo_bar_baz

+ , output); +} + +test "Example 377" { + const output = try convert(std.testing.allocator, + \\_(bar)_. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

(bar).

+ , output); +} + +test "Example 378" { + const output = try convert(std.testing.allocator, + \\**foo bar** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 379" { + const output = try convert(std.testing.allocator, + \\** foo bar** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

** foo bar**

+ , output); +} + +test "Example 380" { + const output = try convert(std.testing.allocator, + \\a**"foo"** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a**"foo"**

+ , output); +} + +test "Example 381" { + const output = try convert(std.testing.allocator, + \\foo**bar** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobar

+ , output); +} + +test "Example 382" { + const output = try convert(std.testing.allocator, + \\__foo bar__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 383" { + const output = try convert(std.testing.allocator, + \\__ foo bar__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__ foo bar__

+ , output); +} + +test "Example 384" { + const output = try convert(std.testing.allocator, + \\__ + \\foo bar__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__ + \\foo bar__

+ , output); +} + +test "Example 385" { + const output = try convert(std.testing.allocator, + \\a__"foo"__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a__"foo"__

+ , output); +} + +test "Example 386" { + const output = try convert(std.testing.allocator, + \\foo__bar__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo__bar__

+ , output); +} + +test "Example 387" { + const output = try convert(std.testing.allocator, + \\5__6__78 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

5__6__78

+ , output); +} + +test "Example 388" { + const output = try convert(std.testing.allocator, + \\пристаням__стремятся__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

пристаням__стремятся__

+ , output); +} + +test "Example 389" { + const output = try convert(std.testing.allocator, + \\__foo, __bar__, baz__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo, bar, baz

+ , output); +} + +test "Example 390" { + const output = try convert(std.testing.allocator, + \\foo-__(bar)__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo-(bar)

+ , output); +} + +test "Example 391" { + const output = try convert(std.testing.allocator, + \\**foo bar ** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

**foo bar **

+ , output); +} + +test "Example 392" { + const output = try convert(std.testing.allocator, + \\**(**foo) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

**(**foo)

+ , output); +} + +test "Example 393" { + const output = try convert(std.testing.allocator, + \\*(**foo**)* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

(foo)

+ , output); +} + +test "Example 394" { + const output = try convert(std.testing.allocator, + \\**Gomphocarpus (*Gomphocarpus physocarpus*, syn. + \\*Asclepias physocarpa*)** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Gomphocarpus (Gomphocarpus physocarpus, syn. + \\Asclepias physocarpa)

+ , output); +} + +test "Example 395" { + const output = try convert(std.testing.allocator, + \\**foo "*bar*" foo** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo "bar" foo

+ , output); +} + +test "Example 396" { + const output = try convert(std.testing.allocator, + \\**foo**bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobar

+ , output); +} + +test "Example 397" { + const output = try convert(std.testing.allocator, + \\__foo bar __ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__foo bar __

+ , output); +} + +test "Example 398" { + const output = try convert(std.testing.allocator, + \\__(__foo) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__(__foo)

+ , output); +} + +test "Example 399" { + const output = try convert(std.testing.allocator, + \\_(__foo__)_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

(foo)

+ , output); +} + +test "Example 400" { + const output = try convert(std.testing.allocator, + \\__foo__bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__foo__bar

+ , output); +} + +test "Example 401" { + const output = try convert(std.testing.allocator, + \\__пристаням__стремятся + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__пристаням__стремятся

+ , output); +} + +test "Example 402" { + const output = try convert(std.testing.allocator, + \\__foo__bar__baz__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo__bar__baz

+ , output); +} + +test "Example 403" { + const output = try convert(std.testing.allocator, + \\__(bar)__. + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

(bar).

+ , output); +} + +test "Example 404" { + const output = try convert(std.testing.allocator, + \\*foo [bar](/url)* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 405" { + const output = try convert(std.testing.allocator, + \\*foo + \\bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\bar

+ , output); +} + +test "Example 406" { + const output = try convert(std.testing.allocator, + \\_foo __bar__ baz_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 407" { + const output = try convert(std.testing.allocator, + \\_foo _bar_ baz_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 408" { + const output = try convert(std.testing.allocator, + \\__foo_ bar_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 409" { + const output = try convert(std.testing.allocator, + \\*foo *bar** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 410" { + const output = try convert(std.testing.allocator, + \\*foo **bar** baz* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 411" { + const output = try convert(std.testing.allocator, + \\*foo**bar**baz* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobarbaz

+ , output); +} + +test "Example 412" { + const output = try convert(std.testing.allocator, + \\*foo**bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo**bar

+ , output); +} + +test "Example 413" { + const output = try convert(std.testing.allocator, + \\***foo** bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 414" { + const output = try convert(std.testing.allocator, + \\*foo **bar*** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 415" { + const output = try convert(std.testing.allocator, + \\*foo**bar*** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobar

+ , output); +} + +test "Example 416" { + const output = try convert(std.testing.allocator, + \\foo***bar***baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobarbaz

+ , output); +} + +test "Example 417" { + const output = try convert(std.testing.allocator, + \\foo******bar*********baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobar***baz

+ , output); +} + +test "Example 418" { + const output = try convert(std.testing.allocator, + \\*foo **bar *baz* bim** bop* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz bim bop

+ , output); +} + +test "Example 419" { + const output = try convert(std.testing.allocator, + \\*foo [*bar*](/url)* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 420" { + const output = try convert(std.testing.allocator, + \\** is not an empty emphasis + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

** is not an empty emphasis

+ , output); +} + +test "Example 421" { + const output = try convert(std.testing.allocator, + \\**** is not an empty strong emphasis + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

**** is not an empty strong emphasis

+ , output); +} + +test "Example 422" { + const output = try convert(std.testing.allocator, + \\**foo [bar](/url)** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 423" { + const output = try convert(std.testing.allocator, + \\**foo + \\bar** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\bar

+ , output); +} + +test "Example 424" { + const output = try convert(std.testing.allocator, + \\__foo _bar_ baz__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 425" { + const output = try convert(std.testing.allocator, + \\__foo __bar__ baz__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 426" { + const output = try convert(std.testing.allocator, + \\____foo__ bar__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 427" { + const output = try convert(std.testing.allocator, + \\**foo **bar**** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 428" { + const output = try convert(std.testing.allocator, + \\**foo *bar* baz** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz

+ , output); +} + +test "Example 429" { + const output = try convert(std.testing.allocator, + \\**foo*bar*baz** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobarbaz

+ , output); +} + +test "Example 430" { + const output = try convert(std.testing.allocator, + \\***foo* bar** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 431" { + const output = try convert(std.testing.allocator, + \\**foo *bar*** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 432" { + const output = try convert(std.testing.allocator, + \\**foo *bar **baz** + \\bim* bop** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar baz + \\bim bop

+ , output); +} + +test "Example 433" { + const output = try convert(std.testing.allocator, + \\**foo [*bar*](/url)** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 434" { + const output = try convert(std.testing.allocator, + \\__ is not an empty emphasis + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__ is not an empty emphasis

+ , output); +} + +test "Example 435" { + const output = try convert(std.testing.allocator, + \\____ is not an empty strong emphasis + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

____ is not an empty strong emphasis

+ , output); +} + +test "Example 436" { + const output = try convert(std.testing.allocator, + \\foo *** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo ***

+ , output); +} + +test "Example 437" { + const output = try convert(std.testing.allocator, + \\foo *\** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *

+ , output); +} + +test "Example 438" { + const output = try convert(std.testing.allocator, + \\foo *_* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo _

+ , output); +} + +test "Example 439" { + const output = try convert(std.testing.allocator, + \\foo ***** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *****

+ , output); +} + +test "Example 440" { + const output = try convert(std.testing.allocator, + \\foo **\*** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *

+ , output); +} + +test "Example 441" { + const output = try convert(std.testing.allocator, + \\foo **_** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo _

+ , output); +} + +test "Example 442" { + const output = try convert(std.testing.allocator, + \\**foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo

+ , output); +} + +test "Example 443" { + const output = try convert(std.testing.allocator, + \\*foo** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo*

+ , output); +} + +test "Example 444" { + const output = try convert(std.testing.allocator, + \\***foo** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo

+ , output); +} + +test "Example 445" { + const output = try convert(std.testing.allocator, + \\****foo* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

***foo

+ , output); +} + +test "Example 446" { + const output = try convert(std.testing.allocator, + \\**foo*** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo*

+ , output); +} + +test "Example 447" { + const output = try convert(std.testing.allocator, + \\*foo**** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo***

+ , output); +} + +test "Example 448" { + const output = try convert(std.testing.allocator, + \\foo ___ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo ___

+ , output); +} + +test "Example 449" { + const output = try convert(std.testing.allocator, + \\foo _\__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo _

+ , output); +} + +test "Example 450" { + const output = try convert(std.testing.allocator, + \\foo _*_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *

+ , output); +} + +test "Example 451" { + const output = try convert(std.testing.allocator, + \\foo _____ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo _____

+ , output); +} + +test "Example 452" { + const output = try convert(std.testing.allocator, + \\foo __\___ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo _

+ , output); +} + +test "Example 453" { + const output = try convert(std.testing.allocator, + \\foo __*__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *

+ , output); +} + +test "Example 454" { + const output = try convert(std.testing.allocator, + \\__foo_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_foo

+ , output); +} + +test "Example 455" { + const output = try convert(std.testing.allocator, + \\_foo__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo_

+ , output); +} + +test "Example 456" { + const output = try convert(std.testing.allocator, + \\___foo__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_foo

+ , output); +} + +test "Example 457" { + const output = try convert(std.testing.allocator, + \\____foo_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

___foo

+ , output); +} + +test "Example 458" { + const output = try convert(std.testing.allocator, + \\__foo___ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo_

+ , output); +} + +test "Example 459" { + const output = try convert(std.testing.allocator, + \\_foo____ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo___

+ , output); +} + +test "Example 460" { + const output = try convert(std.testing.allocator, + \\**foo** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 461" { + const output = try convert(std.testing.allocator, + \\*_foo_* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 462" { + const output = try convert(std.testing.allocator, + \\__foo__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 463" { + const output = try convert(std.testing.allocator, + \\_*foo*_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 464" { + const output = try convert(std.testing.allocator, + \\****foo**** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 465" { + const output = try convert(std.testing.allocator, + \\____foo____ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 466" { + const output = try convert(std.testing.allocator, + \\******foo****** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 467" { + const output = try convert(std.testing.allocator, + \\***foo*** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 468" { + const output = try convert(std.testing.allocator, + \\_____foo_____ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 469" { + const output = try convert(std.testing.allocator, + \\*foo _bar* baz_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo _bar baz_

+ , output); +} + +test "Example 470" { + const output = try convert(std.testing.allocator, + \\*foo __bar *baz bim__ bam* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar *baz bim bam

+ , output); +} + +test "Example 471" { + const output = try convert(std.testing.allocator, + \\**foo **bar baz** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

**foo bar baz

+ , output); +} + +test "Example 472" { + const output = try convert(std.testing.allocator, + \\*foo *bar baz* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo bar baz

+ , output); +} + +test "Example 473" { + const output = try convert(std.testing.allocator, + \\*[bar*](/url) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*bar*

+ , output); +} + +test "Example 474" { + const output = try convert(std.testing.allocator, + \\_foo [bar_](/url) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

_foo bar_

+ , output); +} + +test "Example 475" { + const output = try convert(std.testing.allocator, + \\* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*

+ , output); +} + +test "Example 476" { + const output = try convert(std.testing.allocator, + \\** + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

**

+ , output); +} + +test "Example 477" { + const output = try convert(std.testing.allocator, + \\__ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__

+ , output); +} + +test "Example 478" { + const output = try convert(std.testing.allocator, + \\*a `*`* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a *

+ , output); +} + +test "Example 479" { + const output = try convert(std.testing.allocator, + \\_a `_`_ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a _

+ , output); +} + +test "Example 480" { + const output = try convert(std.testing.allocator, + \\**a + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

**ahttps://foo.bar/?q=**

+ , output); +} + +test "Example 481" { + const output = try convert(std.testing.allocator, + \\__a + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

__ahttps://foo.bar/?q=__

+ , output); +} + +test "Example 482" { + const output = try convert(std.testing.allocator, + \\[link](/uri "title") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 483" { + const output = try convert(std.testing.allocator, + \\[link](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 484" { + const output = try convert(std.testing.allocator, + \\[](./target.md) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 485" { + const output = try convert(std.testing.allocator, + \\[link]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 486" { + const output = try convert(std.testing.allocator, + \\[link](<>) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 487" { + const output = try convert(std.testing.allocator, + \\[]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 488" { + const output = try convert(std.testing.allocator, + \\[link](/my uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link](/my uri)

+ , output); +} + +test "Example 489" { + const output = try convert(std.testing.allocator, + \\[link](
) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 490" { + const output = try convert(std.testing.allocator, + \\[link](foo + \\bar) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link](foo + \\bar)

+ , output); +} + +test "Example 491" { + const output = try convert(std.testing.allocator, + \\[link]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link]()

+ , output); +} + +test "Example 492" { + const output = try convert(std.testing.allocator, + \\[a]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a

+ , output); +} + +test "Example 493" { + const output = try convert(std.testing.allocator, + \\[link]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link](<foo>)

+ , output); +} + +test "Example 494" { + const output = try convert(std.testing.allocator, + \\[a]( + \\[a](c) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[a](<b)c + \\[a](<b)c> + \\[a](c)

+ , output); +} + +test "Example 495" { + const output = try convert(std.testing.allocator, + \\[link](\(foo\)) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 496" { + const output = try convert(std.testing.allocator, + \\[link](foo(and(bar))) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 497" { + const output = try convert(std.testing.allocator, + \\[link](foo(and(bar)) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link](foo(and(bar))

+ , output); +} + +test "Example 498" { + const output = try convert(std.testing.allocator, + \\[link](foo\(and\(bar\)) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 499" { + const output = try convert(std.testing.allocator, + \\[link]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 500" { + const output = try convert(std.testing.allocator, + \\[link](foo\)\:) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 501" { + const output = try convert(std.testing.allocator, + \\[link](#fragment) + \\ + \\[link](https://example.com#fragment) + \\ + \\[link](https://example.com?foo=3#frag) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ \\

link

+ \\

link

+ , output); +} + +test "Example 502" { + const output = try convert(std.testing.allocator, + \\[link](foo\bar) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 503" { + const output = try convert(std.testing.allocator, + \\[link](foo%20bä) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 504" { + const output = try convert(std.testing.allocator, + \\[link]("title") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 505" { + const output = try convert(std.testing.allocator, + \\[link](/url "title") + \\[link](/url 'title') + \\[link](/url (title)) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link + \\link + \\link

+ , output); +} + +test "Example 506" { + const output = try convert(std.testing.allocator, + \\[link](/url "title \""") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 507" { + const output = try convert(std.testing.allocator, + \\[link](/url "title") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 508" { + const output = try convert(std.testing.allocator, + \\[link](/url "title "and" title") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link](/url "title "and" title")

+ , output); +} + +test "Example 509" { + const output = try convert(std.testing.allocator, + \\[link](/url 'title "and" title') + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 510" { + const output = try convert(std.testing.allocator, + \\[link]( /uri + \\ "title" ) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link

+ , output); +} + +test "Example 511" { + const output = try convert(std.testing.allocator, + \\[link] (/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link] (/uri)

+ , output); +} + +test "Example 512" { + const output = try convert(std.testing.allocator, + \\[link [foo [bar]]](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link [foo [bar]]

+ , output); +} + +test "Example 513" { + const output = try convert(std.testing.allocator, + \\[link] bar](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link] bar](/uri)

+ , output); +} + +test "Example 514" { + const output = try convert(std.testing.allocator, + \\[link [bar](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[link bar

+ , output); +} + +test "Example 515" { + const output = try convert(std.testing.allocator, + \\[link \[bar](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link [bar

+ , output); +} + +test "Example 516" { + const output = try convert(std.testing.allocator, + \\[link *foo **bar** `#`*](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link foo bar #

+ , output); +} + +test "Example 517" { + const output = try convert(std.testing.allocator, + \\[![moon](moon.jpg)](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

moon

+ , output); +} + +test "Example 518" { + const output = try convert(std.testing.allocator, + \\[foo [bar](/uri)](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo bar](/uri)

+ , output); +} + +test "Example 519" { + const output = try convert(std.testing.allocator, + \\[foo *[bar [baz](/uri)](/uri)*](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo [bar baz](/uri)](/uri)

+ , output); +} + +test "Example 520" { + const output = try convert(std.testing.allocator, + \\![[[foo](uri1)](uri2)](uri3) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo](uri2)

+ , output); +} + +test "Example 521" { + const output = try convert(std.testing.allocator, + \\*[foo*](/uri) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo*

+ , output); +} + +test "Example 522" { + const output = try convert(std.testing.allocator, + \\[foo *bar](baz*) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *bar

+ , output); +} + +test "Example 523" { + const output = try convert(std.testing.allocator, + \\*foo [bar* baz] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo [bar baz]

+ , output); +} + +test "Example 524" { + const output = try convert(std.testing.allocator, + \\[foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo

+ , output); +} + +test "Example 525" { + const output = try convert(std.testing.allocator, + \\[foo`](/uri)` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo](/uri)

+ , output); +} + +test "Example 526" { + const output = try convert(std.testing.allocator, + \\[foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foohttps://example.com/?search=](uri)

+ , output); +} + +test "Example 527" { + const output = try convert(std.testing.allocator, + \\[foo][bar] + \\ + \\[bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 528" { + const output = try convert(std.testing.allocator, + \\[link [foo [bar]]][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link [foo [bar]]

+ , output); +} + +test "Example 529" { + const output = try convert(std.testing.allocator, + \\[link \[bar][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link [bar

+ , output); +} + +test "Example 530" { + const output = try convert(std.testing.allocator, + \\[link *foo **bar** `#`*][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

link foo bar #

+ , output); +} + +test "Example 531" { + const output = try convert(std.testing.allocator, + \\[![moon](moon.jpg)][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

moon

+ , output); +} + +test "Example 532" { + const output = try convert(std.testing.allocator, + \\[foo [bar](/uri)][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo bar]ref

+ , output); +} + +test "Example 533" { + const output = try convert(std.testing.allocator, + \\[foo *bar [baz][ref]*][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo bar baz]ref

+ , output); +} + +test "Example 534" { + const output = try convert(std.testing.allocator, + \\*[foo*][ref] + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo*

+ , output); +} + +test "Example 535" { + const output = try convert(std.testing.allocator, + \\[foo *bar][ref]* + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo *bar*

+ , output); +} + +test "Example 536" { + const output = try convert(std.testing.allocator, + \\[foo + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo

+ , output); +} + +test "Example 537" { + const output = try convert(std.testing.allocator, + \\[foo`][ref]` + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo][ref]

+ , output); +} + +test "Example 538" { + const output = try convert(std.testing.allocator, + \\[foo + \\ + \\[ref]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foohttps://example.com/?search=][ref]

+ , output); +} + +test "Example 539" { + const output = try convert(std.testing.allocator, + \\[foo][BaR] + \\ + \\[bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 540" { + const output = try convert(std.testing.allocator, + \\[ẞ] + \\ + \\[SS]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 541" { + const output = try convert(std.testing.allocator, + \\[Foo + \\ bar]: /url + \\ + \\[Baz][Foo bar] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Baz

+ , output); +} + +test "Example 542" { + const output = try convert(std.testing.allocator, + \\[foo] [bar] + \\ + \\[bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo] bar

+ , output); +} + +test "Example 543" { + const output = try convert(std.testing.allocator, + \\[foo] + \\[bar] + \\ + \\[bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo] + \\bar

+ , output); +} + +test "Example 544" { + const output = try convert(std.testing.allocator, + \\[foo]: /url1 + \\ + \\[foo]: /url2 + \\ + \\[bar][foo] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

bar

+ , output); +} + +test "Example 545" { + const output = try convert(std.testing.allocator, + \\[bar][foo\!] + \\ + \\[foo!]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[bar][foo!]

+ , output); +} + +test "Example 546" { + const output = try convert(std.testing.allocator, + \\[foo][ref[] + \\ + \\[ref[]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo][ref[]

+ \\

[ref[]: /uri

+ , output); +} + +test "Example 547" { + const output = try convert(std.testing.allocator, + \\[foo][ref[bar]] + \\ + \\[ref[bar]]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo][ref[bar]]

+ \\

[ref[bar]]: /uri

+ , output); +} + +test "Example 548" { + const output = try convert(std.testing.allocator, + \\[[[foo]]] + \\ + \\[[[foo]]]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[[[foo]]]

+ \\

[[[foo]]]: /url

+ , output); +} + +test "Example 549" { + const output = try convert(std.testing.allocator, + \\[foo][ref\[] + \\ + \\[ref\[]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 550" { + const output = try convert(std.testing.allocator, + \\[bar\\]: /uri + \\ + \\[bar\\] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

bar\

+ , output); +} + +test "Example 551" { + const output = try convert(std.testing.allocator, + \\[] + \\ + \\[]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[]

+ \\

[]: /uri

+ , output); +} + +test "Example 552" { + const output = try convert(std.testing.allocator, + \\[ + \\ ] + \\ + \\[ + \\ ]: /uri + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[ + \\]

+ \\

[ + \\]: /uri

+ , output); +} + +test "Example 553" { + const output = try convert(std.testing.allocator, + \\[foo][] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 554" { + const output = try convert(std.testing.allocator, + \\[*foo* bar][] + \\ + \\[*foo* bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 555" { + const output = try convert(std.testing.allocator, + \\[Foo][] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 556" { + const output = try convert(std.testing.allocator, + \\[foo] + \\[] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\[]

+ , output); +} + +test "Example 557" { + const output = try convert(std.testing.allocator, + \\[foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 558" { + const output = try convert(std.testing.allocator, + \\[*foo* bar] + \\ + \\[*foo* bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 559" { + const output = try convert(std.testing.allocator, + \\[[*foo* bar]] + \\ + \\[*foo* bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo bar]

+ , output); +} + +test "Example 560" { + const output = try convert(std.testing.allocator, + \\[[bar [foo] + \\ + \\[foo]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[[bar foo

+ , output); +} + +test "Example 561" { + const output = try convert(std.testing.allocator, + \\[Foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 562" { + const output = try convert(std.testing.allocator, + \\[foo] bar + \\ + \\[foo]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 563" { + const output = try convert(std.testing.allocator, + \\\[foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]

+ , output); +} + +test "Example 564" { + const output = try convert(std.testing.allocator, + \\[foo*]: /url + \\ + \\*[foo*] + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

*foo*

+ , output); +} + +test "Example 565" { + const output = try convert(std.testing.allocator, + \\[foo][bar] + \\ + \\[foo]: /url1 + \\[bar]: /url2 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 566" { + const output = try convert(std.testing.allocator, + \\[foo][] + \\ + \\[foo]: /url1 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 567" { + const output = try convert(std.testing.allocator, + \\[foo]() + \\ + \\[foo]: /url1 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 568" { + const output = try convert(std.testing.allocator, + \\[foo](not a link) + \\ + \\[foo]: /url1 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo(not a link)

+ , output); +} + +test "Example 569" { + const output = try convert(std.testing.allocator, + \\[foo][bar][baz] + \\ + \\[baz]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]bar

+ , output); +} + +test "Example 570" { + const output = try convert(std.testing.allocator, + \\[foo][bar][baz] + \\ + \\[baz]: /url1 + \\[bar]: /url2 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foobaz

+ , output); +} + +test "Example 571" { + const output = try convert(std.testing.allocator, + \\[foo][bar][baz] + \\ + \\[baz]: /url1 + \\[foo]: /url2 + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

[foo]bar

+ , output); +} + +test "Example 572" { + const output = try convert(std.testing.allocator, + \\![foo](/url "title") + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 573" { + const output = try convert(std.testing.allocator, + \\![foo *bar*] + \\ + \\[foo *bar*]: train.jpg "train & tracks" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 574" { + const output = try convert(std.testing.allocator, + \\![foo ![bar](/url)](/url2) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 575" { + const output = try convert(std.testing.allocator, + \\![foo [bar](/url)](/url2) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 576" { + const output = try convert(std.testing.allocator, + \\![foo *bar*][] + \\ + \\[foo *bar*]: train.jpg "train & tracks" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 577" { + const output = try convert(std.testing.allocator, + \\![foo *bar*][foobar] + \\ + \\[FOOBAR]: train.jpg "train & tracks" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 578" { + const output = try convert(std.testing.allocator, + \\![foo](train.jpg) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 579" { + const output = try convert(std.testing.allocator, + \\My ![foo bar](/path/to/train.jpg "title" ) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

My foo bar

+ , output); +} + +test "Example 580" { + const output = try convert(std.testing.allocator, + \\![foo]() + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 581" { + const output = try convert(std.testing.allocator, + \\![](/url) + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 582" { + const output = try convert(std.testing.allocator, + \\![foo][bar] + \\ + \\[bar]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 583" { + const output = try convert(std.testing.allocator, + \\![foo][bar] + \\ + \\[BAR]: /url + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 584" { + const output = try convert(std.testing.allocator, + \\![foo][] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 585" { + const output = try convert(std.testing.allocator, + \\![*foo* bar][] + \\ + \\[*foo* bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 586" { + const output = try convert(std.testing.allocator, + \\![Foo][] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 587" { + const output = try convert(std.testing.allocator, + \\![foo] + \\[] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\[]

+ , output); +} + +test "Example 588" { + const output = try convert(std.testing.allocator, + \\![foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 589" { + const output = try convert(std.testing.allocator, + \\![*foo* bar] + \\ + \\[*foo* bar]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo bar

+ , output); +} + +test "Example 590" { + const output = try convert(std.testing.allocator, + \\![[foo]] + \\ + \\[[foo]]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

![[foo]]

+ \\

[[foo]]: /url "title"

+ , output); +} + +test "Example 591" { + const output = try convert(std.testing.allocator, + \\![Foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 592" { + const output = try convert(std.testing.allocator, + \\!\[foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

![foo]

+ , output); +} + +test "Example 593" { + const output = try convert(std.testing.allocator, + \\\![foo] + \\ + \\[foo]: /url "title" + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

!foo

+ , output); +} + +test "Example 594" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

http://foo.bar.baz

+ , output); +} + +test "Example 595" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

https://foo.bar.baz/test?q=hello&id=22&boolean

+ , output); +} + +test "Example 596" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

irc://foo.bar:2233/baz

+ , output); +} + +test "Example 597" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

MAILTO:FOO@BAR.BAZ

+ , output); +} + +test "Example 598" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

a+b+c:d

+ , output); +} + +test "Example 599" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

made-up-scheme://foo,bar

+ , output); +} + +test "Example 600" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

https://../

+ , output); +} + +test "Example 601" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

localhost:5001/foo

+ , output); +} + +test "Example 602" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<https://foo.bar/baz bim>

+ , output); +} + +test "Example 603" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

https://example.com/\[\

+ , output); +} + +test "Example 604" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo@bar.example.com

+ , output); +} + +test "Example 605" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo+special@Bar.baz-bar0.com

+ , output); +} + +test "Example 606" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<foo+@bar.example.com>

+ , output); +} + +test "Example 607" { + const output = try convert(std.testing.allocator, + \\<> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<>

+ , output); +} + +test "Example 608" { + const output = try convert(std.testing.allocator, + \\< https://foo.bar > + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

< https://foo.bar >

+ , output); +} + +test "Example 609" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<m:abc>

+ , output); +} + +test "Example 610" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<foo.bar.baz>

+ , output); +} + +test "Example 611" { + const output = try convert(std.testing.allocator, + \\https://example.com + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

https://example.com

+ , output); +} + +test "Example 612" { + const output = try convert(std.testing.allocator, + \\foo@bar.example.com + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo@bar.example.com

+ , output); +} + +test "Example 613" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 614" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 615" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 616" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 617" { + const output = try convert(std.testing.allocator, + \\Foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo

+ , output); +} + +test "Example 618" { + const output = try convert(std.testing.allocator, + \\<33> <__> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<33> <__>

+ , output); +} + +test "Example 619" { + const output = try convert(std.testing.allocator, + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<a h*#ref="hi">

+ , output); +} + +test "Example 620" { + const output = try convert(std.testing.allocator, + \\
< + \\foo> + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

< a>< + \\foo><bar/ > + \\<foo bar=baz + \\bim!bop />

+ , output); +} + +test "Example 622" { + const output = try convert(std.testing.allocator, + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<a href='bar'title=title>

+ , output); +} + +test "Example 623" { + const output = try convert(std.testing.allocator, + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 624" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

</a href="foo">

+ , output); +} + +test "Example 625" { + const output = try convert(std.testing.allocator, + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 626" { + const output = try convert(std.testing.allocator, + \\foo foo --> + \\ + \\foo foo --> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo foo -->

+ \\

foo foo -->

+ , output); +} + +test "Example 627" { + const output = try convert(std.testing.allocator, + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 628" { + const output = try convert(std.testing.allocator, + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 629" { + const output = try convert(std.testing.allocator, + \\foo &<]]> + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo &<]]>

+ , output); +} + +test "Example 630" { + const output = try convert(std.testing.allocator, + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 631" { + const output = try convert(std.testing.allocator, + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 632" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

<a href=""">

+ , output); +} + +test "Example 633" { + const output = try convert(std.testing.allocator, + \\foo + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\baz

+ , output); +} + +test "Example 634" { + const output = try convert(std.testing.allocator, + \\foo\ + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\baz

+ , output); +} + +test "Example 635" { + const output = try convert(std.testing.allocator, + \\foo + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\baz

+ , output); +} + +test "Example 636" { + const output = try convert(std.testing.allocator, + \\foo + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\bar

+ , output); +} + +test "Example 637" { + const output = try convert(std.testing.allocator, + \\foo\ + \\ bar + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\bar

+ , output); +} + +test "Example 638" { + const output = try convert(std.testing.allocator, + \\*foo + \\bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\bar

+ , output); +} + +test "Example 639" { + const output = try convert(std.testing.allocator, + \\*foo\ + \\bar* + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo
+ \\bar

+ , output); +} + +test "Example 640" { + const output = try convert(std.testing.allocator, + \\`code + \\span` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

code span

+ , output); +} + +test "Example 641" { + const output = try convert(std.testing.allocator, + \\`code\ + \\span` + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

code\ span

+ , output); +} + +test "Example 642" { + const output = try convert(std.testing.allocator, + \\
+ ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 643" { + const output = try convert(std.testing.allocator, + \\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

+ , output); +} + +test "Example 644" { + const output = try convert(std.testing.allocator, + \\foo\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo\

+ , output); +} + +test "Example 645" { + const output = try convert(std.testing.allocator, + \\foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 646" { + const output = try convert(std.testing.allocator, + \\### foo\ + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo\

+ , output); +} + +test "Example 647" { + const output = try convert(std.testing.allocator, + \\### foo + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo

+ , output); +} + +test "Example 648" { + const output = try convert(std.testing.allocator, + \\foo + \\baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\baz

+ , output); +} + +test "Example 649" { + const output = try convert(std.testing.allocator, + \\foo + \\ baz + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

foo + \\baz

+ , output); +} + +test "Example 650" { + const output = try convert(std.testing.allocator, + \\hello $.;'there + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

hello $.;'there

+ , output); +} + +test "Example 651" { + const output = try convert(std.testing.allocator, + \\Foo χρῆν + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Foo χρῆν

+ , output); +} + +test "Example 652" { + const output = try convert(std.testing.allocator, + \\Multiple spaces + ); + defer std.testing.allocator.free(output); + + try std.testing.expectEqualStrings( + \\

Multiple spaces

+ , output); +} diff --git a/ziglue/src/main.zig b/ziglue/src/main.zig new file mode 100644 index 0000000..b50c9b9 --- /dev/null +++ b/ziglue/src/main.zig @@ -0,0 +1,65 @@ +const std = @import("std"); + +pub fn find_blocks(src: []const u8, blocks: *std.ArrayList([]const u8)) !void { + var idx: usize = 0; + var blk: usize = 0; + + while (idx < src.len) { + const end = std.mem.indexOfAnyPos(u8, src, idx, "\n") orelse src.len; + const line = src[idx..end]; + if (std.mem.indexOfNone(u8, line, " \t\r\n") == null) { + // the line is blank; a block has ended. + const block = src[blk..end]; + + std.debug.print("BLOCK:\n{s}", .{block}); + + try blocks.append(block); + blk = end + 1; + } + idx = end + 1; + } +} + +pub fn convert(alloc: std.mem.Allocator, md: []const u8) ![]const u8 { + return try alloc.dupe(u8, md); + + // _ = alloc; + // _ = md; + // return error.UhOh; + // return error.NotImplemented; + + // return alloc.dupe(u8, "Hello World!"); +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const alloc = gpa.allocator(); + + defer _ = gpa.deinit(); + + var args = try std.process.argsWithAllocator(alloc); + defer args.deinit(); + std.debug.assert(args.skip()); + + var blocks = std.ArrayList([]const u8).init(alloc); + defer blocks.deinit(); + + while (args.next()) |fname| { + const src = load: { + const file = try std.fs.cwd().openFile(fname, .{ .mode = .read_only }); + defer file.close(); + break :load try file.readToEndAlloc(alloc, std.math.maxInt(u32)); + }; + defer alloc.free(src); + + std.log.debug("arg '{s}' {d} bytes", .{ fname, src.len }); + + blocks.clearRetainingCapacity(); + try find_blocks(src, &blocks); + + // try parse(alloc, src); + + // const tokens = try parse(alloc, src); + // defer alloc.free(tokens); + } +}