fix(markdown): comprehensive improvements to markdown block/inline parsing and UI rendering - #3094
Open
Yashh56 wants to merge 4 commits into
Open
fix(markdown): comprehensive improvements to markdown block/inline parsing and UI rendering#3094Yashh56 wants to merge 4 commits into
Yashh56 wants to merge 4 commits into
Conversation
…rbitrary letter fallback to unordered list
Contributor
Author
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.

PR Description
Summary
This PR introduces a series of robust fixes to the Markdown parser and UI rendering engine. It addresses multiple edge cases in both block- and inline-Markdown parsing, ensuring that complex combinations—such as nested lists, blockquotes containing lists, and nested inline elements—are formatted precisely to specification.
It also resolves a UI styling conflict with spoiler elements.
Key Changes
1. Block-Level Parsing
Nested Lists: Refactored indentation tracking (
buildListstack) to accurately map indentation depths, ensuring nested lists are generated with the correct hierarchy rather than being flattened.Ordered Lists:
10.,100.), which were previously failing to parse.a,A,i,I), preventing arbitrary letters (e.g.,Q.) from erroneously triggering list creation.-metadata attribute, accidentally converting them to unordered lists.Unordered Lists: Fixed
getListTypeto properly recognize hyphens (-) alongside asterisks (*) as valid unordered list markers.Blockquotes: Enabled recursive parsing inside
BlockQuoteRule, allowing internal block elements (such as lists or headings) to be formatted correctly within a quote rather than rendering as raw text.2. Inline-Level Parsing
Rule Precedence: Moved
CodeRuleintoLeveledRulesto fix regex precedence issues. This prevents inline code blocks from prematurely splitting strings, which previously broke outer syntax such as links or spoilers containing code.Escaped Characters: Added
\[and\]toINLINE_SEQUENCE_SETso that escaped square brackets are correctly unescaped and ignored by the link parser.3. UI & Styling
Spoiler Visibility: Fixed a styling conflict where child elements inside an unrevealed spoiler (such as
<code />blocks with distinct backgrounds/colors) remained visible.Used Vanilla Extract's
globalStyleto applyopacity: 0to all descendants of an unrevealed spoiler, ensuring everything is completely hidden until clicked.Testing
10. Foo).Q. Foo) are gracefully parsed as regular paragraphs.\[bracket\]) render as raw text.||) properly mask inline<code />blocks.Close: #2845