Skip to content

EscapeAt extension resets line endings set by ConfigureNewListExtension #1031

Description

@hartez

By default, Markdig uses LF for line endings, even on Windows. If I check out a git repository for a Statiq-generated website on Windows and git converts the line endings to CRLF, the next time I invoke Statiq to regenerate the site every Markdown -> HTML process will result in LF line endings for all the files. So even though I may have edited only 1 Markdown file, every HTML document in the output shows as "modified". This isn't tragic; git will automatically fix up the line endings for me. But it does result in a lot of noise in git status.

Markdig supplies an extension to modify this behavior. In theory, I can add UseExtension(new ConfigureNewLineExtension("\r\n")) to my pipeline and when I generate the site on Windows, the line endings will match.

Unfortunately, the EscapteAtExtension, which is always last in the extension setup process, inadvertently resets any configured .NewLine property when it sets the TextWriter for the HtmlRenderer, and the output always ends up using LF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions