fix(html-comment): fix html comments from being visible in the rich editor#211
fix(html-comment): fix html comments from being visible in the rich editor#211giamir wants to merge 1 commit intoStackExchange:mainfrom
Conversation
|
Thank you for the PR! I'll try and review the next chance I get. |
|
Hi @b-kelly, |
|
@giamir Sorry, I've been up to my eyeballs in non-Stacks-Editor related tasks this last week. I plan on getting a new release out by the end of the month (this week likely), so my goal is to have your PR reviewed and merged by then. Thank you for your patience! |
|
No problem, @b-kelly. |
Closes #195
Hello, first time contributor here. 👋
I thought I would pick up an issue labeled as
good first issueto familiarize myself with the codebase and your code conventions. I have to say the PR turned out to be a bit bigger than I initially thought. Nevertheless I hope this is useful and I look forward to your feedback.Describe your changes
Issue Analysis
The blue bar in RT mode described in #195 appears because of this CSS rule which applies to all selected
html_blocknodes markdown-it parses out (html comments are treated as any anotherhtml_blocknode).Furthermore I found that all the html comments get a margin bottom in RT mode (which I assume is not desired behavior) as a consequence of being categorized as any other
html_blockby the parser.Proposed Solution
The solution I implemented introduces an
html_commentmarkdown-it plugin which allows to differentiate html comments and handle them accordingly in the RT mode.The plugin detects only html comments blocks.
Html comments inlined with other elements/text are ignored and they are processed as they were before.
A more detailed explanation about the plugin's logic can be found in the related unit test file (
html-comment.test.ts).PR Checklist
/** ... */docsbug/enhancementand other labels as appropriateEnvironment(s) tested