microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.43k stars 28.62k forks source link

Markdown Preview render fails for table containing pipe `|` inside backticks #131859

Closed obiwanjacobi closed 3 years ago

obiwanjacobi commented 3 years ago

Issue Type: Bug

  1. create a table in an .md file that has a | inside back-ticks:
    | header1 | Header2
    |--|--
    | `|` | <= this fails
  2. Open the markdown preview and look at the rendered table.

Looks like the pipe chars | inside the backticks are parsed as part of the table layout. Note that previous version(s) did render correctly.

VS Code version: Code 1.59.1 (3866c3553be8b268c8a7f8c0482c0c0177aa8bfa, 2021-08-19T11:56:46.957Z) OS version: Windows_NT x64 10.0.18363 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.74GB (8.43GB free)| |Process Argv|--crash-reporter-id 6b27853a-b4bc-4f56-974f-f441f0805512| |Screen Reader|no| |VM|0%|
Extensions (60) Extension|Author (truncated)|Version ---|---|--- vscode-openapi|42C|4.6.1 better-comments|aar|2.1.0 armview|ben|0.4.5 vscode-raml|blz|3.0.1 waveform-render|bmp|0.18.0 format-json|Cle|1.0.2 bracket-pair-colorizer-2|Coe|0.2.1 vscode-markdownlint|Dav|0.43.2 xml|Dot|2.5.1 gitlens|eam|11.6.0 EditorConfig|Edi|0.16.4 gc-excelviewer|Gra|3.0.43 terraform|has|2.14.0 rest-client|hum|0.24.5 zingularity|Jac|0.0.9 llvm-tablegen|jak|0.0.2 vscode-peacock|joh|3.9.1 restructuredtext|lex|157.0.0 autoconf|mae|0.1.0 vscode-antlr4|mik|2.2.4 binary-viewer|mom|0.0.1 vscode-apimanagement|ms-|1.0.3 vscode-azurefunctions|ms-|1.5.0 vscode-azurelogicapps|ms-|1.0.4 vscode-azureresourcegroups|ms-|0.4.0 vscode-azureterraform|ms-|0.3.2 vscode-azurevirtualmachines|ms-|0.4.1 vscode-bicep|ms-|0.4.613 vscode-docker|ms-|1.16.0 vscode-logicapps|ms-|1.0.19 csharp|ms-|1.23.14 vscode-dotnet-runtime|ms-|1.2.0 python|ms-|2021.8.1159798656 vscode-pylance|ms-|2021.8.3 jupyter|ms-|2021.8.1236758218 remote-wsl|ms-|0.58.2 azure-account|ms-|0.9.8 cpptools|ms-|1.6.0 hexeditor|ms-|1.8.2 powershell|ms-|2021.8.2 vscode-typescript-tslint-plugin|ms-|1.3.3 azurerm-vscode-tools|msa|0.15.2 veriloghdl|msh|1.5.0 debugger-for-chrome|msj|4.12.12 indent-rainbow|ode|7.5.0 platformio-ide|pla|2.3.3 awesome-vhdl|puo|0.0.1 vscode-commons|red|0.0.6 vscode-yaml|red|0.22.0 llvm|RRe|0.1.1 cupl-syntax-highlighter|Rya|1.1.1 partial-diff|ryu|1.4.3 shopify-liquid|sis|2.3.0 shader|sle|1.1.5 code-spell-checker|str|1.10.2 tabspace|Tak|0.0.1 html-preview-vscode|tht|0.2.5 pdf|tom|1.1.0 vscode-icons|vsc|11.6.0 debug|web|0.25.1 (1 theme extensions excluded)
usernamehw commented 3 years ago

It needs to be escaped (even in backticks):

| header1 | Header2
|--|--
| `\|` | <= this fails
header1 Header2
\| <= this fails
mjbvz commented 3 years ago

Closing as this is consistent with how markdown-it renders that text as well

Lemmingh commented 2 years ago

markdown-it has aligned its "table" implementation with GitHub Flavored Markdown since version 12. GitHub made the decision for deterministic parsing.

That's why pipes (|) have to be escaped (\|) now.