Skip to content

fix(export/markdown): avoid over-stripping indentation in ranged tags#1823

Open
YsuOS wants to merge 1 commit into
nvim-neorg:mainfrom
YsuOS:fix-markdown
Open

fix(export/markdown): avoid over-stripping indentation in ranged tags#1823
YsuOS wants to merge 1 commit into
nvim-neorg:mainfrom
YsuOS:fix-markdown

Conversation

@YsuOS

@YsuOS YsuOS commented Jun 15, 2026

Copy link
Copy Markdown

Use math.min to clamp the strip amount to the actual leading whitespace, preventing striping non-whitespace characters. when a line has less indentation than tag_indent.

Use math.min to clamp the strip amount to the actual leading whitespace,
preventing striping non-whitespace characters. when a line has less
indentation than tag_indent.
@YsuOS

YsuOS commented Jun 15, 2026

Copy link
Copy Markdown
Author

Test result

  • Src norg file
$ cat /tmp/test.norg
* Title
  - bullet point
  @code
ABCDEFG
abcdefg
  @end
  @code
  ABCDEFG
  abcdefg
  @end
  @code
    ABCDEFG
    abcdefg
  @end
  • Actual result: the "ab" is stripped in the first code block because this line start from column 0 but the tag_indent is 2.
$ cat /tmp/test-before.md
# Title

- bullet point
```
ABCDEFG
cdefg  <<<--- HERE!!
```
```
ABCDEFG
abcdefg
```
```
  ABCDEFG
  abcdefg
```
  • Expected result (with this patch)
$ cat /tmp/test-after.md
# Title

- bullet point
```
ABCDEFG
abcdefg
```
```
ABCDEFG
abcdefg
```
```
  ABCDEFG
  abcdefg
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant