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

[BUG] Citations not rendered #2031

Open leoauri opened 4 months ago

leoauri commented 4 months ago

Describe the bug I preview a markdown document with citations. The citations are not rendered.

Environment

To Reproduce Steps to reproduce the behavior:

  1. Create a .md file such as:
    
    ---
    title: test
    bibliography: bib.bib
    ---

Hello @heBagTricksImage2018

[@heBagTricksImage2018] doesn't work either

2. Create a `bib.bib` file in the same directory such as:

@misc{heBagTricksImage2018, title = {Bag of {{Tricks}} for {{Image Classification}} with {{Convolutional Neural Networks}}}, author = {He, Tong and Zhang, Zhi and Zhang, Hang and Zhang, Zhongyue and Xie, Junyuan and Li, Mu}, year = {2018}, month = dec, number = {arXiv:1812.01187}, eprint = {1812.01187}, primaryclass = {cs}, publisher = {arXiv}, urldate = {2023-11-02}, abstract = {Much of the recent progress made in image classification research can be credited to training procedure refinements, such as changes in data augmentations and optimization methods. In the literature, however, most refinements are either briefly mentioned as implementation details or only visible in source code. In this paper, we will examine a collection of such refinements and empirically evaluate their impact on the final model accuracy through ablation study. We will show that, by combining these refinements together, we are able to improve various CNN models significantly. For example, we raise ResNet-50's top-1 validation accuracy from 75.3\% to 79.29\% on ImageNet. We will also demonstrate that improvement on image classification accuracy leads to better transfer learning performance in other application domains such as object detection and semantic segmentation.}, archiveprefix = {arXiv}, langid = {english}, keywords = {Computer Science - Computer Vision and Pattern Recognition}, file = {/Users/leoauri/Zotero/storage/NGFUMQ32/He et al. - 2018 - Bag of Tricks for Image Classification with Convol.pdf} }

3. (optional) add 
"markdown-preview-enhanced.pandocArguments": [
   "--citeproc", 
]

to `settings.json` (don't know if this is supposed to be done).

4. click "Markdown Preview Enhanced: Open Preview to the Side"

**Expected behavior**
See a preview with the citations rendered.

**Actual behaviour**
See a preview with citations in @thisFormat2024 (unrendered) and no references at the end.

Help?
leoauri commented 4 months ago
# pandoc --version
pandoc 3.2.1
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/leoauri/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
# man pandoc
...
       -C, --citeproc
              Process the citations in the file, replacing them with rendered
              citations and adding a bibliography.  Citation processing will
...
leoauri commented 4 months ago

Solution: setting markdown-preview-enhanced.usePandocParser made it work. This isn't mentioned on the docs citations page, and for people unfamiliar with the plugin, I think it needs to be.