Skip to content

Fix markdown horizontal rule detection - #3434

Merged
Julia Roldi (juliaroldi) merged 1 commit into
masterfrom
u/juliaroldi/markdown-detector-backslash
Aug 14, 2026
Merged

Fix markdown horizontal rule detection#3434
Julia Roldi (juliaroldi) merged 1 commit into
masterfrom
u/juliaroldi/markdown-detector-backslash

Conversation

@juliaroldi

@juliaroldi Julia Roldi (juliaroldi) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Update isContentMarkdown to recognize only exactly three dashes as a Markdown horizontal rule. This prevents four or more dashes from being classified as Markdown content and adds a regression test for the behavior.
MarkdownPasteConversion

How to test

  1. Verify isContentMarkdown('---') returns true, while isContentMarkdown('----') returns false.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-14 18:29 UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request tightens Markdown detection in roosterjs-content-model-markdown by making horizontal rule recognition stricter to avoid misclassifying plain text (4+ dashes) as Markdown during paste/content checks.

Changes:

  • Update the horizontal-rule block pattern in isContentMarkdown to match exactly ---.
  • Add a regression test ensuring ---- is not treated as a Markdown horizontal rule.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/roosterjs-content-model-markdown/lib/publicApi/isContentMarkdown.ts Narrows the horizontal rule regex from “3+ dashes” to exactly three dashes.
packages/roosterjs-content-model-markdown/test/publicApi/isContentMarkdownTest.ts Adds a regression test to ensure 4 dashes does not trigger Markdown detection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@juliaroldi
Julia Roldi (juliaroldi) merged commit c7f9fc0 into master Aug 14, 2026
9 checks passed
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.

3 participants