Skip to content
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

Code block markup does not follow recommendations by WHATWG, causes issues with 3rd party plugins #2628

Open
testudor opened this issue Apr 29, 2024 · 0 comments

Comments

@testudor
Copy link

Environment


  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, modules, content
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-9baaph?file=nuxt.config.ts,content%2Findex.md

Describe the bug

The WHATWG (Web Hypertext Application Technology Working Group) recommends code block markup to be structured as follows:

<pre>
  <code class="language-pascal">
    var i: Integer;
    begin
       i := 1;
    end.
  </code>
</pre>

(taken from https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element)

Nuxt Content uses a different format, where the language-xxx class is placed on the pre element instead. This breaks compatibility with some 3rd party plugins such as https://github.com/remcohaszing/rehype-mermaid. Is there any good reason Nuxt Content does not follow the spec? Please also see the discussion here: remcohaszing/rehype-mermaid#15.

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant