Since dprint-plugin-markdown-0.17.3, escaping a pipe in a markdown table returns a different result.
Additionally, it will also generate different reports between check and fmt.
Is this an intentional change?
Expected behavior
fmt keeps same rendering result in GFM
Even though changing the behaviors, I expect dprint fmt to return the same result as dprint check reports.
Logs
Tested with dprint 0.45.1 and 0.47.2. And markdown-0.17.2, markdown-0.17.3, markdown-0.17.4
> dprint --version
dprint 0.45.1
Target markdown file
| f\|oo |
| ------ |
| b `\|` az |
| b **\|** im |
| `command \| filter` |
It interprets as below in GitHub
f\
oo
b \| az
b | im
command \| filter
0.17.2 fmt result does not affect rendering result
f\
oo
b \| az
b | im
command \| filter
0.17.3 fmt changes the rendering result
f\
oo
b `
b | im
`command
Appendix
Reproduction Script for 0.17.2
```bash
cd "$(mktemp --directory)"
cat <<'JSON' > ./dprint.json
{
"markdown": {},
"plugins": [
"https://plugins.dprint.dev/markdown-0.17.2.wasm"
]
}
JSON
mdtable="$(mktemp --suffix=.md --tmpdir="$PWD")"
cat <<'MARKDOWN' > "$mdtable"
| f\|oo |
| ------ |
| b `\|` az |
| b **\|** im |
| `command \| filter` |
MARKDOWN
dprint check
dprint fmt
cat "$mdtable"
```
check result
```console
> dprint check
from /tmp/tmp.sT0fsTwBE7/tmp.E2tDbfiEg5.md:
1|-|·f\|oo··|
2|-|·------·|
3|-|·b·`\|`·az·|
4|-|·b·**\|**·im·|
1 |+|·f\|oo···············|
2 |+|·-------------------·|
3 |+|·b·`\|`·az···········|
4 |+|·b·**\|**·im·········|
5 5| |·`command·\|·filter`·|
--
Found 1 not formatted file.
```
fmt result
```console
> dprint fmt
Formatted 1 file.
> cat "$mdtable"
| f\|oo |
| ------------------- |
| b `\|` az |
| b **\|** im |
| `command \| filter` |
```
Reproduction Script for 0.17.3
```bash
cd "$(mktemp --directory)"
cat <<'JSON' > ./dprint.json
{
"markdown": {},
"plugins": [
"https://plugins.dprint.dev/markdown-0.17.3.wasm"
]
}
JSON
mdtable="$(mktemp --suffix=.md --tmpdir="$PWD")"
cat <<'MARKDOWN' > "$mdtable"
| f\|oo |
| ------ |
| b `\|` az |
| b **\|** im |
| `command \| filter` |
MARKDOWN
dprint check
dprint fmt
cat "$mdtable"
```
check result
```console
> dprint check
from /tmp/tmp.talxYkpfIp/tmp.zDeiKDP0rM.md:
1|-|·f\|oo··|
2|-|·------·|
3|-|·b·`\|`·az·|
4|-|·b·**\|**·im·|
5|-|·`command·\|·filter`·|
1 |+|·f\|oo··············|
2 |+|·------------------·|
3 |+|·b·`|`·az···········|
4 |+|·b·**\|**·im········|
5 |+|·`command·|·filter`·|
--
Found 1 not formatted file.
```
fmt result
```console
> dprint fmt
Formatted 1 file.
> cat tmp.zDeiKDP0rM.md
| f\|oo |
| ----------- |
| b ` |
| b **\|** im |
| `command |
```
Description
Since dprint-plugin-markdown-0.17.3, escaping a pipe in a markdown table returns a different result. Additionally, it will also generate different reports between
check
andfmt
.Is this an intentional change?
Expected behavior
fmt
keeps same rendering result in GFMdprint fmt
to return the same result asdprint check
reports.Logs
Tested with dprint
0.45.1
and0.47.2
. Andmarkdown-0.17.2
,markdown-0.17.3
,markdown-0.17.4
Target markdown file
It interprets as below in GitHub
\|
azcommand \| filter
0.17.2
fmt
result does not affect rendering result\|
azcommand \| filter
0.17.3
fmt
changes the rendering resultAppendix
Reproduction Script for 0.17.2
```bash cd "$(mktemp --directory)" cat <<'JSON' > ./dprint.json { "markdown": {}, "plugins": [ "https://plugins.dprint.dev/markdown-0.17.2.wasm" ] } JSON mdtable="$(mktemp --suffix=.md --tmpdir="$PWD")" cat <<'MARKDOWN' > "$mdtable" | f\|oo | | ------ | | b `\|` az | | b **\|** im | | `command \| filter` | MARKDOWN dprint check dprint fmt cat "$mdtable" ``` check result ```console > dprint check from /tmp/tmp.sT0fsTwBE7/tmp.E2tDbfiEg5.md: 1|-|·f\|oo··| 2|-|·------·| 3|-|·b·`\|`·az·| 4|-|·b·**\|**·im·| 1 |+|·f\|oo···············| 2 |+|·-------------------·| 3 |+|·b·`\|`·az···········| 4 |+|·b·**\|**·im·········| 5 5| |·`command·\|·filter`·| -- Found 1 not formatted file. ``` fmt result ```console > dprint fmt Formatted 1 file. > cat "$mdtable" | f\|oo | | ------------------- | | b `\|` az | | b **\|** im | | `command \| filter` | ```Reproduction Script for 0.17.3
```bash cd "$(mktemp --directory)" cat <<'JSON' > ./dprint.json { "markdown": {}, "plugins": [ "https://plugins.dprint.dev/markdown-0.17.3.wasm" ] } JSON mdtable="$(mktemp --suffix=.md --tmpdir="$PWD")" cat <<'MARKDOWN' > "$mdtable" | f\|oo | | ------ | | b `\|` az | | b **\|** im | | `command \| filter` | MARKDOWN dprint check dprint fmt cat "$mdtable" ``` check result ```console > dprint check from /tmp/tmp.talxYkpfIp/tmp.zDeiKDP0rM.md: 1|-|·f\|oo··| 2|-|·------·| 3|-|·b·`\|`·az·| 4|-|·b·**\|**·im·| 5|-|·`command·\|·filter`·| 1 |+|·f\|oo··············| 2 |+|·------------------·| 3 |+|·b·`|`·az···········| 4 |+|·b·**\|**·im········| 5 |+|·`command·|·filter`·| -- Found 1 not formatted file. ``` fmt result ```console > dprint fmt Formatted 1 file. > cat tmp.zDeiKDP0rM.md | f\|oo | | ----------- | | b ` | | b **\|** im | | `command | ```Links