markdown_preview: Fix code block highlight and indentation (#27463)
Closes #23218 Before: <img width="1463" alt="before" src="https://github.com/user-attachments/assets/4f77a4e0-61b8-4516-91a4-366f73e24760" /> After: <img width="1463" alt="after" src="https://github.com/user-attachments/assets/61e2c69d-fa6b-4c52-b1eb-ad7a61e274e0" /> Release Notes: - Fixed issue where code block highlight and indentation in markdown preview was rendered incorrectly.
This commit is contained in:
parent
30f7e896cf
commit
ee08776f34
1 changed files with 4 additions and 1 deletions
|
@ -718,6 +718,9 @@ impl<'a> MarkdownParser<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
code = code.strip_suffix('\n').unwrap_or(&code).to_string();
|
||||
|
||||
let highlights = if let Some(language) = &language {
|
||||
if let Some(registry) = &self.language_registry {
|
||||
let rope: language::Rope = code.as_str().into();
|
||||
|
@ -735,7 +738,7 @@ impl<'a> MarkdownParser<'a> {
|
|||
|
||||
ParsedMarkdownCodeBlock {
|
||||
source_range,
|
||||
contents: code.trim().to_string().into(),
|
||||
contents: code.into(),
|
||||
language,
|
||||
highlights,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue