mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
fix: prevent spurious leading spaces in nested codeBlock interior lines
When a codeBlock is nested inside an indented structure like a bulletListItem, the \_render_block\ function prepends the block's indentation \prefix\ to every line. However, for codeBlock elements, only the fence markers (the opening and closing \\\) should carry the block indentation. Interior code lines must not have the prefix prepended, because markdown parsers treat leading spaces inside a code fence as part of the code content. This fix removes the prefix from interior code lines to prevent code snippets stored in notes from gaining spurious whitespace.
This commit is contained in:
parent
ee241e0ff2
commit
147c690051
1 changed files with 1 additions and 1 deletions
|
|
@ -133,7 +133,7 @@ def _render_block(
|
||||||
code_text = _render_inline_content(content) if content else ""
|
code_text = _render_inline_content(content) if content else ""
|
||||||
lines.append(f"{prefix}```{language}")
|
lines.append(f"{prefix}```{language}")
|
||||||
for code_line in code_text.split("\n"):
|
for code_line in code_text.split("\n"):
|
||||||
lines.append(f"{prefix}{code_line}")
|
lines.append(code_line)
|
||||||
lines.append(f"{prefix}```")
|
lines.append(f"{prefix}```")
|
||||||
|
|
||||||
elif block_type == "table":
|
elif block_type == "table":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue