Inconsistent display of bare indented code blocks and fenced code blocks (```) in Markdown preview
See original GitHub issueType: Bug
Steps to reproduce:
- Open a Markdown editor.
- Enter the following code:
[short|long] [signed|unsigned] int [signed|unsigned] char float [long] double ``` [short|long] [signed|unsigned] int [signed|unsigned] char float [long] double ```
- Preview the Markdown, for example by clicking the “Open Preview to the Side” button.
Expected behavior: The two code blocks are rendered the same.
Actual behavior: The two code blocks are rendered with slightly different margins and line heights:
Does this issue occur when all extensions are disabled?: Yes
VS Code version: Code - Insiders 1.71.0-insider (28f604dec81b609dd7e69362585f7a99d4c48f88, 2022-08-19T05:17:14.894Z) OS version: Windows_NT x64 10.0.19042 Modes: Sandboxed: Yes
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i5-5250U CPU @ 1.60GHz (4 x 1600) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
Load (avg) | undefined |
Memory (System) | 3.90GB (0.46GB free) |
Process Argv | –crash-reporter-id adc3af8c-0978-48bc-aa94-fbd604e9e143 |
Screen Reader | no |
VM | 0% |
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Markdown with fenced code blocks within lists has ...
This is a bug because the JavaScript-rendered preview HTML should ... The Markdown I wrote included fenced code blocks within list items.
Read more >Markdown renderer changes indentation inside fenced code ...
Markdown renderer changes indentation inside fenced code blocks ... This is true both for the live preview and for the persistent rendering.
Read more >Markdownlint Rules
This rule is triggered when you skip heading levels in a markdown document, ... Note: Trailing space is allowed in indented and fenced...
Read more >Markdown Style Guide - Rocket.Chat Docs
All the rules listed here have their respective code attached here, ... MD005 - No inconsistent indentation for list items at the same...
Read more >Format messages - Mattermost Documentation
Use Markdown. You can also format your messages in Mattermost using Markdown to control text styling, links, headings, lists, code blocks, in-line code ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried to fix this bug by overriding default rule of code_block. This makes the rendered DOM of code_block and fence are same.
Render rule is defined at markdown-it and rule of code_block and fence are differ. It causes make difference of rendered DOM between these.
https://github.com/markdown-it/markdown-it/blob/2b6cac25823af011ff3bc7628bc9b06e483c5a08/lib/renderer.js#L30-L36
https://github.com/markdown-it/markdown-it/blob/2b6cac25823af011ff3bc7628bc9b06e483c5a08/lib/renderer.js#L39-L90
@mjbvz It looks like the spacing between ‘<code’ and ‘<div’ is different due to them using different layers, for this case, should we both use ‘<code<div xxx </div<code’ ?