mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3242] Markdown headings render as literal # text when a file has Windows (CRLF) line endings #1742
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1742
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3242
Originally assigned to: @kolacheee on GitHub.
What happens
When the markdown renderer is given text with Windows-style line endings (CRLF,
\r\n), headings are not converted — the preview shows the literal text# Game Assets Creditsat body-text size instead of a styled heading. Tables, bold, and inline code in the same file render fine, which makes the broken headings stand out.Try it yourself (on a Windows install)
CREDITS.md(every install has one) — it opens straight into Preview.# .../## ...line.# Hello, and preview it — that heading converts fine, because files created in-app use plain\nline endings.Why it happens
renderMarkdownBlocksinpackages/client/src/lib/markdown.tsxsplits content on"\n"only (line 378). For a CRLF file, every line keeps a trailing\r. The heading regex/^(#{1,6})\s+(.+)$/can't match across that carriage return (in JavaScript regexes,.and$stop at\r), so heading lines fall through and render as plain paragraph text. The table parser happens to call.trim()on each line first — which strips the\r— so tables work, headings don't.The seeded
CREDITS.mdgets CRLF endings on Windows because git converts text files at checkout and the seeder copies the file byte-for-byte. Any markdown file written by a Windows editor and dropped into game assets hits the same problem. Chat messages are unaffected (typed/streamed content uses\n).Fix
One-line change: split on
/\r?\n/instead of"\n"so CRLF and LF input parse identically. This also protects the other line-anchored patterns in the block parser that don't trim. Related: #3240 fixed the preview's missing styles; this bug is independent of that one (the heading#marks survive even with styling fixed). I'm taking this one (kolacheee) — PR tostagingincoming.