Repository navigation
Conversation
GetMarkdownScore returned 0 as soon as the text contained anything looking like an HTML tag. Markdown may legitimately embed raw HTML, and technical writing routinely mentions tags inside inline code or fenced blocks, so a single occurrence vetoed every other signal. That only mattered when the clipboard carried both text and HTML, which is exactly what editors and browsers publish - so copying Markdown that mentions a tag was classified as rich text, and Ctrl+Enter converted a document that was already Markdown. Ignore markup inside code when checking, and weigh the remainder against the other signals instead of vetoing them. Text that really is HTML still scores low enough to be treated as rich text. Fixes #14 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b721ad5f-9add-4f55-b9c8-7e6d7b0fb3e7
Owner
Author
|
Superseded by #53. These commits are already contained in that branch, so this PR would merge nothing on its own. Collapsing the stacked converter PRs into one avoids the base-rewriting problem that made the stack unmergeable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14.
Problem
GetMarkdownScorevetoed the entire score on any HTML-looking tag:This only bites when the clipboard carries both text and HTML — which is exactly what editors and browsers publish. So Markdown that merely mentions a tag was classified as rich text, and
Ctrl+Enterran HTML → Markdown on a document that was already Markdown.Change
Verification
All cases below have the same syntax-highlighted editor HTML on the clipboard alongside the text, which is what triggers the bug.
# Title+ list +**bold**MarkdownMarkdown# Layout+ list +`<div class="card">`RichText❌Markdown✅# Title+ list + fenced```htmlblockRichText❌Markdown✅<h1>Hi</h1><p>there</p>(HTML source as text)RichTextRichTextRichTextRichTextRichTextRichTextUnknownUnknownNo regressions: the two cases that must stay
RichTextstill do, including a paste whose plain-text side has no Markdown syntax at all.dotnet build -c Release -r win-x64succeeds with 0 warnings.