Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Indentation and Formatting with latexindent on Markdown Files #566

Open
newptcai opened this issue Oct 4, 2024 · 2 comments
Labels
text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html text-wrap-after

Comments

@newptcai
Copy link
Contributor

newptcai commented Oct 4, 2024

I encountered issues while using latexindent with the following Markdown file, test.md, which contains three lines:

As I sit here in my chambers, surrounded by the trappings of power, I am reminded of the impermanence of all things. Like the fleeting seasons, our lives too are subject to change and uncertainty.  It is in these moments of introspection that I come to realize how much I rely on external sources for guidance and wisdom, rather than trusting my own inner compass.  The mind is a fragile thing, susceptible to the whispers of doubt and fear.

As I sit here in my chambers, surrounded by the trappings of power, I am reminded of the impermanence of all things. Like the fleeting seasons, our lives too are subject to change and uncertainty.  It is in these moments of introspection that I come to realize how much I rely on external sources for guidance and wisdom, rather than trusting my own inner compass.  The mind is a fragile thing, susceptible to the whispers of doubt and fear.

Please note that lines 1 and 3 are identical.

Here are my settings:

# default value of indentation
defaultIndent: "    "

modifyLineBreaks:
    preserveBlankLines: 1
    condenseMultipleBlankLinesInto: 1
    oneSentencePerLine:
        removeSentenceLineBreaks: 1
        removeBlockLineBreaks: 0
        sentencesFollow:
            other: "\)|\}"
        sentencesEndWith:
            basicFullStop: 1
            other: "\:|\;|\,"
        sentencesBeginWith:
            a-z: 1
        manipulateSentences: 1
        textWrapSentences: 1
    textWrapOptions:
        multipleSpacesToSingle: 1
        columns: 90
        preamble: 0
        when: after

lookForPreamble:
  .md: 0

verbatimEnvironments:
    longtable: 1

verbatimCommands:
    titleformat: 1
    titlerule: 1
    href: 1

Problem 1:

When I run latexindent -m test.md, the result is:

As I sit here in my chambers,
surrounded by the trappings of power,
I am reminded of the impermanence of all things.
Like the fleeting seasons,
our lives too are subject to change and uncertainty.
It is in these moments of introspection that I come to realize how much I rely on
external sources for guidance and wisdom,
rather than trusting my own inner compass.
The mind is a fragile thing,
susceptible to the whispers of doubt and fear.

                   As I sit here in my chambers,
surrounded by the trappings of power,
I am reminded of the impermanence of all things.
Like the fleeting seasons,
our lives too are subject to change and uncertainty.
It is in these moments of introspection that I come to realize how much I rely on
external sources for guidance and wisdom,
rather than trusting my own inner compass.
The mind is a fragile thing,
susceptible to the whispers of doubt and fear.

As seen here, an extra indentation is applied to the second paragraph, which is unexpected.

Problem 2:

When I run latexindent -m -n 1 test.md, the output is correct.

However, when I run latexindent -m -n 3 test.md, the output becomes inconsistent with the first paragraph:

... (line 1 unchanged) ...

As I sit here in my chambers, surrounded by the trappings of power, I am reminded of the impermanence of all things.
 Like the fleeting seasons,
our lives too are subject to change and uncertainty.
It is in these moments of introspection that I come to realize how much I rely on
external sources for guidance and wisdom,
rather than trusting my own inner compass.
The mind is a fragile thing,
susceptible to the whispers of doubt and fear.

This inconsistency between paragraphs when using the -n flag is unexpected and incorrect.

@cmhughes
Copy link
Owner

cmhughes commented Oct 4, 2024

I imagine this is about text wrap after....

@newptcai
Copy link
Contributor Author

newptcai commented Oct 5, 2024

Yes. Switching to before then it is fine. But then I have long lines without punctuation marks which are not wrapped.

@cmhughes cmhughes added text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html text-wrap-after labels Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html text-wrap-after
Projects
None yet
Development

No branches or pull requests

2 participants