Reference-Style Image/Link Attributes (Like MultiMarkdown 3+)
Closed this issue · 6 comments
How difficult would it be to get markdown-it-implicit-figures
to parse image/link attributes like MultiMarkdown does? (You're already half-way there with this whole project :D)
Here's a screenshot of some example Markdown parsing:
Specifically, consider this Markdown:
![Alternate text][1]
[1]: image_link "Title" width=100px
parsing as I've suggested would lead to this result
<figure>
<img src="image_link" alt="Alternate text" title="Title" width="100px">
<figcaption>Alternate text</figcaption>
</figure>
For a stretch goal, how about allowing any image/link reference with any random attribute?
Consider this Markdown, with the more generic inline style
attribute, with the width
parameter and value
declared:
![Alternate text][1]
[1]: image_link "Title" style="width: 100px;"
parse:
<figure>
<img src="image_link" alt="Alternate text" title="Title" style="width: 100px;">
<figcaption>Alternate text</figcaption>
</figure>
Or, even a class
or id
attribute in the Markdown:
![Alternate text][1]
[1]: image_link "Title" style="width: 100px;" class="small" id="pic"
parse:
<figure>
<img src="image_link" alt="Alternate text" title="Title" style="width: 100px;" class="small" id="pic">
<figcaption>Alternate text</figcaption>
</figure>
Is this too difficult to achieve?
Your's is so close to the MultiMarkdown 3 spec already though! :)
Well, I'm not trying to ape MultiMarkdown, I'm aping pandoc.
Though, it should be relative easy to implement, if you make an effort. I will accept PRs.
Something like this, but more generic maybe? https://github.com/tatsy/markdown-it-imsize/blob/master/dist/markdown-it-imsize.js
I'm not a JavaScript guy, so I don't really know :(
We basically need to identify that any string of text following the [optional] image title title
should be passed unaffected to the resultant <img>
within the <figure>
, right?
Not sure how to do that :/
Then maybe do a regex plugin? Or hire someone.
Closing, as this is outside the scope of markdown-it-implicit-figures.