Skip to content

Preserve deterministic line endings in generated Markdown output #67

Description

@jeffpatton1971

Context

Projects consuming Xml2Doc.MSBuild can see large documentation-only diffs after an otherwise clean restore/build. On Windows, Git repeatedly reports warnings such as:

LF will be replaced by CRLF the next time Git touches it

This makes generated Markdown appear modified across builds or workstations even when the semantic documentation content has not changed.

The behavior is especially disruptive in repositories with many generated API documentation files because a normal Release build can dirty numerous tracked documents and obscure the actual implementation changes.

Objective

Make Xml2Doc-generated Markdown line endings deterministic and configurable so identical XML documentation input and options produce byte-identical Markdown output across supported operating systems and Git configurations.

Scope to investigate

  • Identify whether generated Markdown currently uses Environment.NewLine, platform-default writer behavior, source-template line endings, or mixed newline handling.
  • Define an explicit output line-ending policy for generated Markdown.
  • Prefer a deterministic cross-platform default, likely LF, unless compatibility evidence supports another default.
  • Consider a renderer option for LF, CRLF, or platform-native output if consumers require explicit control.
  • Ensure every generated file uses one consistent line-ending sequence.
  • Avoid rewriting otherwise unchanged files solely because the executing workstation uses a different native newline.
  • Document the interaction with .gitattributes and Git core.autocrlf without relying on Git settings for renderer determinism.

Acceptance criteria

  • The same XML documentation input and renderer options produce byte-identical Markdown on Windows, Linux, and macOS.
  • Generated files contain no mixed line endings.
  • Repeated generation does not dirty tracked Markdown files when semantic content is unchanged.
  • Tests cover LF and CRLF behavior explicitly at the byte/string level.
  • A cross-platform regression test verifies the default output policy is independent of Environment.NewLine.
  • The selected default and any configuration option are documented for CLI and MSBuild consumers.

Design constraint

Line-ending determinism should be owned by Xml2Doc output generation. Consumer repositories may still use .gitattributes, but Git configuration should not be required to make the generator stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions