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.

Conflict with markdown-it-container

See original GitHub issue

When using this plugin with markdown-it container all the attrs for the elements inside get’s merged with the attrs for the container unless there are more than one level of nested containers.

If I set attrs for a container, it get’s inserted on the container attrs array as expected. (needs custom render function but that’s a bug for the container plugin)

Example input:

::: column {.is-8}
Lorem ipsum
:::

Current output:

<div class="column is-8">
<p>Lorem ipsum</p>
</div>

But if I set attrs on the child, the attrs are set on the container:

::: column {.is-8}
# Some title here {.title}

Lorem ipsum
:::

It outputs:

<div class="column is-8 title">
<h1>Some title here</h1>
<p>Lorem ipsum</p>
</div>

Expected output:

<div class="column is-8">
<h1 class="title">Some title here</h1>
<p>Lorem ipsum</p>
</div>

When using nested containers it works as expected

:::: columns {.is-mobile}
::: column {.is-8}

# lorem ipsum {.title}

more lorem ipsum

:::
::::

outputs:

<div class="is-mobile columns">
<div class="is-8 column">
<h1 id="lorem-ipsum" class="title">lorem ipsum</h1>
<p>more lorem ipsum</p>
</div>
</div>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cesasolcommented, Jul 13, 2018

Attributes first, but I tested inverting the order and the result is the same.

0reactions
StefanZandercommented, Jul 26, 2020

I am using both extensions markdown-it-attrs and markdown-it-container in conjunction with Marp in order to create my lecture slides.

When combining both extensions, e.g.,

::: definition
some def text...

Source: some source text {.source}
:::

the .source class will be propagated to the definition container (the parent div) rather than to the paragraph that represents the source text.

The problem as described in post #1 is still present to me.

I also tried the workaround proposed by @mb21 but it does not work in my setup.

Since I really like both extensions, I hope there is another way of making both work together.

Thanks in advance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

markdown-it-container - npm
Plugin to create block-level custom containers for markdown-it markdown parser. Latest version: 3.0.0, last published: 3 years ago.
Read more >
high speed, pluggable parser for JS, with CommonMark support
I tried .use(require('markdown-it-container'), name); but that threw an error in my node.js app.
Read more >
podman-container-cleanup
podman container cleanup cleans up exited containers by removing all ... IMPORTANT: Conflicts with --rmi as the container is not being cleaned up...
Read more >
podman: .../markdown/podman-container-clone.1.md.in | Fossies
A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode...
Read more >
Merge conflicts - GitLab Documentation
Use the merge conflict resolution editor to resolve complex conflicts in the GitLab interface: Go to your merge request. Select Overview, and scroll...
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