Skip to content

Inconsistent Indentation and Formatting with latexindent on Markdown Files #566

@newptcai

Description

@newptcai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    text-wraptext wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.htmltext-wrap-after

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions