executablebooks / markdown-it-docutils

A markdown-it plugin for implementing docutils style roles/directives.
https://executablebooks.github.io/markdown-it-docutils/
MIT License
12 stars 8 forks source link

bug: admonition class names don't remove spaces (e.g. "See Also") #22

Closed Pugio closed 2 years ago

Pugio commented 2 years ago

Describe the bug

context

   ```{seealso}
      seealso
   `` `

expectation

<aside class="admonition seealso">
  <header class="admonition-title">See Also</header>
  <p>seealso</p>
</aside>

bug

<aside class="admonition see also">
  <header class="admonition-title">See Also</header>
  <p>seealso</p>
</aside>

solution admonitions.ts#L31 should read:

if (this.title) adToken.attrJoin("class", this.title.replace(/ /g, '').toLowerCase())

Personally, I would prefer it to read this.title.replace(/ +/g, '-') – converting admonition title spaces into kebab-case, as this would make the resulting CSS styling nicer to read. Doing so would mean updating the current CSS rules for seealso however, and so might be a larger change.

Reproduce the bug

   ```{seealso}
      seealso
   `` `

List your environment

No response

chrisjsewell commented 2 years ago

Yep thanks, I would note that sphinx adds it as seealso: https://github.com/sphinx-doc/sphinx/blob/e54b63d3eead95ef3fac1906deae54b6972573e4/sphinx/writers/html.py#L289, so I would want to stick to that

rowanc1 commented 2 years ago

This is fixed in #24! Thanks for the report @Pugio.

rowanc1 commented 2 years ago

This has been merged into main, but not yet released. Hoping that we can get a release out soon!

rowanc1 commented 2 years ago

Released in 0.1.2:

https://github.com/executablebooks/markdown-it-docutils/releases/tag/v0.1.2