question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Pandoc style image attributes

See original GitHub issue

What is the problem?

Pandoc has this way of adding attributes to an image tag:

An inline ![image](foo.jpg){#id .class width=30 height=20px} with attributes.

Seen in https://pandoc.org/MANUAL.html#Images.

Currently, the extension doesn’t support this syntax, and will display the attributes {#id .class width=30 height=20px} as text following the image instead.

We are only able to write something like

[<img src="foo.jpg" width="30" height=20px/>](image)

to get the same behavior (which is to change the image size in this case), and pandoc will not display the image in an generated PDF.

It would be very nice if the extension supports the Pandoc syntax, since I write in markdown and use Pandoc to generate latex style documents, and it would be cool to see the images displayed the way they would be in a PDF.

How can I reproduce it?

Have an image named foo.jpg in the same directory as the markdown file, and include ![image](foo.jpg){#id .class width=30 height=20px} in the file.

Is there any error message in the console?

No.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yzhang-ghcommented, Feb 27, 2020

Glad to hear that.

The good thing is we can use this extension and MPE at the same time (no conflict). It is a solution for those who need more features than that of the CommonMark/GitHub Flavored Markdown.

0reactions
justinchubycommented, Feb 27, 2020

I checked using the Pacdoc parser. It works great now.

For reference, I needed to add --mathjax to the pandoc arguments and change the “Pandoc markdown flavor” to markdown-raw_tex+tex_math_dollars, both of which are Markdown Preview Enhanced settings.

I still appreciate the nice features of Markdown All in One. I like how it respects the markdown css settings and how fast it runs. Thanks for developing such great extensions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandoc User's Guide
List supported styles for syntax highlighting, one per line. ... It is recommended that the image be less than 1000px in width and...
Read more >
correctly sizing PNG images in markdown with pandoc for html ...
figures/myimage.png" alt="my caption" style="width: 250px;"/> ... The other writers ignore attributes that are not supported by their output ...
Read more >
How to avoid img size tags on markdown when converting ...
The easiest (and most standard-compliant) method is to convert to commonmark . However, CommonMark allows raw HTML snippets, so pandoc tries to ...
Read more >
Support for image dimensions - CommonMark Discussion
For HTML/EPUB all attributes are passed through “as is”. This provides elegant support for all future responsive image properties (e.g. srcset , ...
Read more >
Changelog for pandoc-2.2.1 - Hackage - Haskell.org
Docx writer: Support underline (#4633). * Text.Pandoc. ... + Write image width specified in percent in Text::Amuse mode. + Don't wrap displayMath into ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found