Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions crates/crates_io_markdown/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ impl<'a> MarkdownRenderer<'a> {
.build();

let extension_options = ComrakExtensionOptions::builder()
.alerts(true)
.autolink(true)
.multiline_block_quotes(true)
.strikethrough(true)
.table(true)
.tagfilter(true)
Expand Down Expand Up @@ -670,4 +672,30 @@ There can also be some text in between!
</picture>
"#);
}

#[test]
fn markdown_alerts() {
let text = "> [!note]\n> Something of note";
assert_snapshot!(markdown_to_html(text, None, ""), @r#"
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title">Note</p>
<p>Something of note</p>
</div>
"#);
}

#[test]
fn markdown_multiline_block_quotes_complex() {
let text = "Paragraph one\n\n>>>\nParagraph two\n\n- one\n- two\n>>>";
assert_snapshot!(markdown_to_html(text, None, ""), @r#"
<p>Paragraph one</p>
<blockquote>
<p>Paragraph two</p>
<ul>
<li>one</li>
<li>two</li>
</ul>
</blockquote>
"#);
}
}
16 changes: 16 additions & 0 deletions tests/acceptance/readme-rendering-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ graph TD;
C-->D;
</code></pre>

<h3>GitHub Style Alert</h3>
<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title">Note</p>
<p>Something of note</p>
</div>

<h3>GitLab Style Multiline Block Quotes</h3>
<p>Paragraph one</p>
<blockquote>
<p>Paragraph two</p>
<ul>
<li>one</li>
<li>two</li>
</ul>
</blockquote>

<ul>
<li>
<p>Delegate to a method with a different name</p>
Expand Down
Loading