Repository navigation
fix: ignore headings inside code fences in rule sections, and clear Test Rule's loading text - #373
Open
thelastbackspace wants to merge 1 commit into
Conversation
… Test Rule's loading text parseSection and the Rule Editor form's section reader treated every `# ...` line as a heading, even inside a fenced example, so a fenced `# When Triggered` line cut the Description short and was read as the When Triggered section. Both now skip lines inside a closed code fence, using a shared fencedLines helper. Test Rule wrote its loading text with textContent into the element preact renders into. Preact doesn't own that text node, so it stayed above the result, and for a rule without thresholds every run after the first showed only the loading text. It's rendered through preact now. Fixes microsoft#343
github-actions
Bot
requested review from
TamasBoncz,
Aymen (aymenfurter) and
Sanjay Singh (san360)
November 4, 2026 08:07
Open
2 of 3 tasks
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.
Description
Two fixes from #343.
The rule parser ended a section at any line starting with
#, including lines inside a fenced code block. So a Description with a fenced example like# When Triggeredgot cut off at the fence, and the fenced line was read as the When Triggered section.parseSectionand the Rule Editor form'ssectionBlocksnow both skip headings inside a closed fence (a small sharedfencedLineshelper insrc/core/markdown-fences.ts), so they still read sections the same way. A fence marker that never closes doesn't count, so a stray ``` can't hide the rest of the rule.Test Rule set its loading text with
textContenton the element preact renders into. Preact doesn't own that text node, so it stayed above the result, and for a rule without thresholds the second run showed only the loading text. I render it through preact instead.I updated the three tests that pinned the old behavior. The "heading inside the detect block" tests now open the detect block mid-line, which is the case where a heading inside it can still happen, so the read-only handling stays covered. None of the 45 built-in rules change.
Related Issues
Fixes #343
Checklist
npm run checkpasses (typecheck + lint + spellcheck + knip + tests). The 8 failing tests also fail on main.