shd101wyy / vscode-markdown-preview-enhanced

One of the "BEST" markdown preview extensions for Visual Studio Code
https://shd101wyy.github.io/markdown-preview-enhanced
Other
1.49k stars 172 forks source link

Pandoc section labels not found by pandoc-crossref filter when using ATX-style headers (in vscode) #1657

Open robwalton opened 6 years ago

robwalton commented 6 years ago

I am using the popular pandoc-crossref filter in both atom and vscode. The filter works properly for setext-style headings but not for ATX-style headings.

The problem

The following works in the preview window (using setext-style headings).

testing {#sec:testing}
=======

This is [@sec:testing].

Whereas this, using ATX-style headings, results only in the error Undefined cross-reference: sec:testing in the preview panel.

# testing {#sec:testing}

This is [@sec:testing].

It works fine from outside vscode using:

$ printf "# testing {#sec:testing}\n\nThis is [@sec:testing]" | pandoc -f markdown-raw_tex+tex_math_single_backslash -t html --mathjax --number-sections --filter=pandoc-crossref
<h1 id="sec:testing"><span class="header-section-number">1</span> testing</h1>
<p>This is sec. 1.</p>

Configuration

My user settings include only:

{
    "markdown-preview-enhanced.usePandocParser": true,
    "markdown-preview-enhanced.pandocArguments": "--number-sections, --filter=pandoc-crossref",
}

Versions

EDITED: To indicate problem occurs in both vscode and atom

robwalton commented 6 years ago

I've found the root of the problem and described it in this more precise ticket: Labels which include a colon in ATX-style headings are altered before passing to pandoc. It turns out that pandoc strips the sec: from the {#sec:testing} label before calling pandoc.

(Apologies for filing one of these in your atom tracker and one in the vscode one! The problem impacts both.)