-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue mixing figures with markdown-it-attrs #18
Comments
Ref #13 |
@arve0 Oh, i didn't look at closed issues. I confirm is still present at latest version |
Yes. I haven't looked into it yet. |
Regression added in a7aab96, |
This is the order that i was using: const md = new MarkdownIt({
html: true,
})
md.use(MarkdownItSamp)
md.use(MarkdownItImplicitFigures, {
figcaption: true,
})
md.use(MarkdownItAttrs) |
plugin markdown-it-implicit-figures is added before linkify, so to assure that attrs plugin is added before implicit-figures .use() attrs first, then implicit-figures: md.use(attrs).use(implicitFigures) ref: arve0/markdown-it-implicit-figures#18
After arve0/markdown-it-attrs#35 is merged and published, change the order you load the plugins: const md = new MarkdownIt({
html: true,
})
md.use(MarkdownItSamp)
md.use(MarkdownItAttrs)
md.use(MarkdownItImplicitFigures, {
figcaption: true,
}) |
* fix typography test * add plugin before linkify plugin markdown-it-implicit-figures is added before linkify, so to assure that attrs plugin is added before implicit-figures .use() attrs first, then implicit-figures: md.use(attrs).use(implicitFigures) ref: arve0/markdown-it-implicit-figures#18 * output in runkit.com is last line, fix demo
@arve0 Sadly i can't confirm its working! It's still the same result using |
Please link to an example which reproduces your error, like in runkit.com or jsfiddle. |
I'm unable to reproduce this locally. Are you sure you have done |
Wait a minute! |
Please update |
Now it works! Thanks! (sorry for the deleted message) |
Hi there! It looks like I'm having the same issue (I can have attributes, or implicit figures, but not both for the same image). The only difference in my use case is that I'm using the markdown-it-loader in Webpack 2. The loader requires the various markdown-it plugins to be passed in during configuration, so I'm not sure if I have much control over the order here. I'm using the latest versions of all packages. Here's an abbreviated version of the webpack config file: var webpack = require('webpack')
// Markdown-it Plugins
var footnotes = require('markdown-it-footnote')
var subscript = require('markdown-it-sub');
var superscript = require('markdown-it-sup');
var figures = require('markdown-it-implicit-figures')
var attrs = require('markdown-it-attrs')
module.exports = {
// various other rules, etc. omitted for brevity
module: {
rules: [
{
test: /\.md$/,
use: [
{
loader: 'html-loader'
},
{
loader: 'markdown-it-loader'
}
]
}
]
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
'markdown-it': {
preset: 'default',
html: true,
typographer: true,
use: [
footnotes,
superscript,
subscript,
attrs,
[figures, { figcaption: true }]
]
}
}
})
]
} When I require a Markdown file into the build pipeline, implicit figures OR attributes work for a given image, but adding say a class to an image means that the <!-- This creates an image wrapped in <figure> tags with a <figcaption> -->
![Dick Higgins in Copenhagen, 1962][fig2]
<!-- This outputs an <img> tag with class="foo" -->
![George Maciunas in Dusseldorf][fig3]{.foo} Any ideas on what might be happening here? I can try to put a small app together to illustrate the use case if this would be helpful. |
markdown-it-attrs just had a major rewrite, so the bug may have been reintroduced. I'll have to investigate. |
@egardner Thanks for reporting. Should be fixed in markdown-it-attrs |
Perfect, I updated |
Hi there!
I'm having an issue mixing this plugin with markdown-it-attrs (monopoly! 😝 ).
This works:
[![](fig.png)](page.html)
But if you do this:
[![](fig.png)](page.html){target="_blank"}
, now there is no<figure>
. It becomes a plain<p><a><img>
:/I want to do it because i want the linked image to open on a separate window if possible
Thanks!
BTW: i have no idea of how to fix it!
The text was updated successfully, but these errors were encountered: