Implement code and pre blocks support on web#341
Implement code and pre blocks support on web#341BartoszGrajdek wants to merge 12 commits intomainfrom
Conversation
| break; | ||
| case 'code': | ||
| Object.assign(node.style, markdownStyle.code); | ||
| Object.assign(node.style, {...markdownStyle.code, lineHeight: 1.4}); |
There was a problem hiding this comment.
I believe this is something we should discuss. We can't set the display to inline-block or block because it will break how we are positioning inline-code blocks.
Since we're not able to do so margin won't work on inline-code block. That's why I decided to set the line-height to 1.4 - In my opinion it looks alright but let me know what do you think 😄
|
Found a couple of bugs while testing: 1. It's impossible to remove the newline between the first syntax `backticks` and `code block`Screen.Recording.2024-05-09.at.09.35.48.mov2. After removing whole content from code block, there are some new lines addedScreen.Recording.2024-05-09.at.09.44.26.mov3. Strange selection behavior when trying to select whole `codeblock`Screen.Recording.2024-05-09.at.09.46.43.mov4. Cursor is wrongly positioned when removing syntax backticks at the end of `codeblock`Screen.Recording.2024-05-09.at.09.51.02.mov |
|
The bugs that I previously reported have been fixed, thank you! After your changes I've only found the problem with cursor positioning when entering newline after first backticks: Videohttps://github.com/Expensify/react-native-live-markdown/assets/39538890/beeed721-10ae-49a6-8727-cda96d746bfd |
|
Hi, when testing I found a problem with cursor positioning when writing on Firefox: Screen.Recording.2024-06-04.at.09.09.35.mov |
|
Firefox: after pasting code block text is still highlighted Test stringScreen.Recording.2024-06-04.at.09.29.51.mov |
This is related to a regression caused by another PR - we'll work on solving it in another issue |

Details
Adds support for displaying and customising code and pre blocks on web.
Related Issues
GH_LINK
Manual Tests
codeFencein ExpensiMark to /(```(?:\r\n|\n))((?:\s*?(?!(?:\r\n|\n)?```(?!`))[\S])+\s*?(?:\r\n|\n))(```)/gnpm run buildin/parserLinked PRs