Restore direct use of the input text for Markdown Text
(#27620)
PR #24388 changed the markdown parsing to copy parsed text in order to handle markdown escaping, removing the optimization to instead reuse text from the input. Another issue with that change was that handling of finding links within `Text` intermixed use of `text` and `parsed`, relying on the offsets matching up (which I believe was true in practice). The solution is to distinguish pulldown_cmark `Text` nodes that share bytes with the input and those that do not. Release Notes: - N/A
This commit is contained in:
parent
4bcd37a537
commit
e74af03065
3 changed files with 201 additions and 64 deletions
|
@ -868,8 +868,11 @@ impl Element for MarkdownElement {
|
|||
}
|
||||
_ => log::debug!("unsupported markdown tag end: {:?}", tag),
|
||||
},
|
||||
MarkdownEvent::Text(parsed) => {
|
||||
builder.push_text(parsed, range.start);
|
||||
MarkdownEvent::Text => {
|
||||
builder.push_text(&parsed_markdown.source[range.clone()], range.start);
|
||||
}
|
||||
MarkdownEvent::SubstitutedText(text) => {
|
||||
builder.push_text(text, range.start);
|
||||
}
|
||||
MarkdownEvent::Code => {
|
||||
builder.push_text_style(self.style.inline_code.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue