Skip to content

Commit eda1c40

Browse files
committed
updated cmark-pulldown dependency
1 parent 978a28b commit eda1c40

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

Cargo.lock

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asciidoctrine/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tera = "1"
3030
docx-rs = "0.4"
3131
log = { workspace = true }
3232
simple_logger = { version = "5", features = ["stderr"] }
33-
pulldown-cmark = "0.9"
33+
pulldown-cmark = "0.13"
3434

3535
[dev-dependencies]
3636
pretty_assertions = "1"

asciidoctrine/src/reader/markdown.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub use crate::ast::*;
22
use crate::options::Opts;
33
use crate::util::Env;
44
use crate::Result;
5-
use pulldown_cmark::{Event, Parser, Tag, HeadingLevel, CodeBlockKind, Options};
5+
use pulldown_cmark::{Event, Parser, Tag, TagEnd, HeadingLevel, CodeBlockKind, Options};
66
use std::collections::HashMap;
77

88
pub struct MarkdownReader {}
@@ -66,11 +66,11 @@ impl MarkdownReader {
6666
let element = match tag {
6767
Tag::Paragraph => Element::Paragraph,
6868

69-
Tag::Heading(level, _, _) => Element::Title {
69+
Tag::Heading { level, .. } => Element::Title {
7070
level: Self::heading_level_to_u32(level),
7171
},
7272

73-
Tag::BlockQuote => Element::TypedBlock {
73+
Tag::BlockQuote(_) => Element::TypedBlock {
7474
kind: BlockType::Quote,
7575
},
7676

@@ -199,7 +199,7 @@ impl MarkdownReader {
199199
continue;
200200
}
201201

202-
Tag::Link(_link_type, dest_url, title) => {
202+
Tag::Link { dest_url, title, .. } => {
203203
let dest_str = dest_url.to_string();
204204
let title_str = title.to_string();
205205

@@ -243,7 +243,7 @@ impl MarkdownReader {
243243
continue;
244244
}
245245

246-
Tag::Image(_link_type, dest_url, title) => {
246+
Tag::Image { dest_url, title, .. } => {
247247
let dest_str = dest_url.to_string();
248248
let title_str = title.to_string();
249249

@@ -277,6 +277,13 @@ impl MarkdownReader {
277277
continue;
278278
}
279279

280+
Tag::HtmlBlock => {
281+
// HTML blocks will have their content collected via Event::Html
282+
Element::TypedBlock {
283+
kind: BlockType::Passtrough,
284+
}
285+
}
286+
280287
_ => {
281288
// For unsupported tags, create a generic element
282289
Element::Text
@@ -303,7 +310,7 @@ impl MarkdownReader {
303310

304311
Event::End(tag) => {
305312
match tag {
306-
Tag::CodeBlock(_) => {
313+
TagEnd::CodeBlock => {
307314
// For code blocks, the content is in current_text
308315
if let Some(mut elem) = stack.pop() {
309316
elem.attributes.push(Attribute {
@@ -400,7 +407,7 @@ impl MarkdownReader {
400407
}
401408
}
402409

403-
Event::Html(html) => {
410+
Event::Html(html) | Event::InlineHtml(html) => {
404411
// Treat HTML as passthrough content
405412
let (start_line, start_col) = Self::byte_offset_to_position(input, range.start);
406413
let (end_line, end_col) = Self::byte_offset_to_position(input, range.end);

0 commit comments

Comments
 (0)