Skip to content

Remove at most one leading space from comments#9

Merged
boolangery merged 1 commit into
boolangery:masterfrom
Lattay:master
Jul 20, 2026
Merged

Remove at most one leading space from comments#9
boolangery merged 1 commit into
boolangery:masterfrom
Lattay:master

Conversation

@Lattay

@Lattay Lattay commented Nov 1, 2023

Copy link
Copy Markdown
Contributor

Hi,

I want to use your sphinx-lua project and I noticed that currently all leading spaces are removed from each line.
This is not compatible with the significant indentation used in rst syntax. For example a multiline list would not be handled as expected:

--- Foo
--- * single line elements works as expected
--- * multi line elements
---   are supposed to be aligned with the previous lines
--- * but the leading spaces are removed by the parser
function foo()
    print("foo")
end

This PR simply change the line where the leading comment mark was removed to remove at most one leading space.
The problem was that the lstrip method takes a list of independent characters as an argument, not a fixed string.

Hopefully, this fix fits your vision for this project.

@boolangery
boolangery merged commit 6c29585 into boolangery:master Jul 20, 2026
boolangery added a commit that referenced this pull request Jul 20, 2026
PR #9 changed comment stripping from lstrip (removes all
leading dashes/spaces) to removing exactly the prefix plus
at most one space. This preserves list bullet markers in
comments. Update test JSON to match new behavior:
- class short_desc: preserves leading dash (list marker)
- module short_desc: preserves separator dashes
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.

2 participants