Skip to content

Fix prompt-ending --- rendering last line as a bold heading#10

Open
Matteovanypersele wants to merge 1 commit into
mainfrom
fix/markdown-thematic-break
Open

Fix prompt-ending --- rendering last line as a bold heading#10
Matteovanypersele wants to merge 1 commit into
mainfrom
fix/markdown-thematic-break

Conversation

@Matteovanypersele

Copy link
Copy Markdown
Collaborator

Many prompts end with a line of dashes (---) used as a courses content delimiter in the dataset templates. In Markdown, a text line immediately followed by --- (with no blank line in between) is a setext heading: the dashes act as an underline and turn the previous line into an <h2>. As a result, the last line of those prompts was rendered large/bold instead of plain text.

This is standard CommonMark behavior, not a parser bug but it wasn't the intended rendering for these prompts.

Fix

Add isolateThematicBreaks in Prompt.tsx, called inside render(). It inserts the missing blank line around lone dash/equals lines, forcing them to render as a horizontal rule (<hr>) instead of underlining the previous line:

  • text\n--- → setext heading (bug)
  • text\n\n--- → horizontal rule (intended)

Inline dashes (e.g. a---b) are untouched, since the setext rule only applies to a line made entirely of dashes. The fix covers every render path.

@Duchemin-tony Duchemin-tony force-pushed the fix/markdown-thematic-break branch from 3336429 to 4d649bd Compare June 10, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants