Repository navigation
Add h1 markdown - #468
Add h1 markdown#468
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
| expect(parser.htmlToMarkdown(testString)).toBe(resultString); | ||
| }); | ||
|
|
||
| test('Test heading1 markdown replacement', () => { |
There was a problem hiding this comment.
I think you should split these tests up. For example this one is testing
- normal
# Headingcase - cases with multiple spaces (
# Heading) - cases with none (
#Heading).
You can split this into 3 small and simple tests that'll be easier to read. Also this way there's no need for the long message in the test string that explains everything 😅
There was a problem hiding this comment.
yeah I like your suggestion 👍
Co-authored-by: Andrew Rosiclair <arosiclair@expensify.com>
arosiclair
left a comment
There was a problem hiding this comment.
Thanks for the changes!
|
Heyhey! Heads up that this PR caused this issue. We basically forgot to handle a case where the # was followed by two spaces and a new line |
| }, | ||
| { | ||
| name: 'heading1', | ||
| regex: /\s*<(h1)(?:"[^"]*"|'[^']*'|[^'">])*>(.*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))\s*/gi, |
There was a problem hiding this comment.
👋
This has caused a regression in Expensify/App#17998.
We were removing all of the new line breaks before <h1> tag, (\s), but should remove whitespaces ([^\S\r\n]).
More details here
| { | ||
| name: 'heading1', | ||
| regex: /^#(?!#) +(.+)$/gm, | ||
| replacement: '<h1>$1</h1>', | ||
| }, |
There was a problem hiding this comment.
This rule was misplaced. It should have been placed before quote rule, because the quote rule consumes the newlines chars i.e. \n. This made such markdown fail > a\n# b. (Coming from Expensify/App#21846)
Part of this DesignDoc.
Adds support for heading markdown. A line which starts with # and a space (
#) is wrapped with<h1></h1>tag.Fixed Issues
https://github.com/Expensify/Expensify/issues/225615
Tests
expensify-commonlocal repository by following these stepsQA