Skip to content

Auto-generated title incorrect when not using Unix newline encoding (LF) #7156

Description

@andgeno

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Page titles will be rendered incorrectly depending on which newline format has been chosen.

✔ Linux (LF): Works as expected. Text of the first Markdown header is displayed.
❌ Windows (CRLF): Original filename and text of the first Markdown header is displayed.
❌ macOS (CR): Original filename is displayed. It's also missing the "Hello" text.

Here is a repro repository:

https://github.com/andgeno/docusaurus-repro-newline-encoding-bug

See the second commit for the actual demo files involved.

Some screenshots:

image

image

image

image

Reproducible demo

https://github.com/andgeno/docusaurus-repro-newline-encoding-bug

Steps to reproduce

  • Create a new file and encode it Windows or macOS newline format.
  • Add a Markdown header to make the title look different / nicer than just the raw filename.
  • Visit page of that new file.
  • Page title will be rendered incorrectly.

Expected behavior

Titles should render the same in all cases.

Actual behavior

Titles render wrong depending on chosen newline format.

Your environment

  • Docusaurus version used: 2.0.0-beta.18

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionclosed: duplicateThis issue or pull request already exists in another issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions