mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Emit code blocks for auto-links in docs
This commit is contained in:
parent
ea5da5d477
commit
0291d5d0c0
1 changed files with 18 additions and 1 deletions
|
@ -850,7 +850,7 @@ fn markdown_to_html(
|
|||
Some(&mut broken_link_callback),
|
||||
)
|
||||
.fold((0, 0), |(start_quote_count, end_quote_count), event| {
|
||||
match event {
|
||||
match &event {
|
||||
// Replace this sequence (`>>>` syntax):
|
||||
// Start(BlockQuote)
|
||||
// Start(BlockQuote)
|
||||
|
@ -898,6 +898,23 @@ fn markdown_to_html(
|
|||
(0, end_quote_count + 1)
|
||||
}
|
||||
}
|
||||
Event::End(Link(LinkType::ShortcutUnknown, _url, _title)) => {
|
||||
// Replace the preceding Text node with a Code node, so it
|
||||
// renders as the equivalent of [`List.len`] instead of [List.len]
|
||||
match docs_parser.pop() {
|
||||
Some(Event::Text(string)) => {
|
||||
docs_parser.push(Event::Code(string));
|
||||
}
|
||||
Some(first) => {
|
||||
docs_parser.push(first);
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
docs_parser.push(event);
|
||||
|
||||
(start_quote_count, end_quote_count)
|
||||
}
|
||||
_ => {
|
||||
docs_parser.push(event);
|
||||
(0, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue