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

feat: How to add HTML attributes to <code> under <pre> within Markdown #3642

Open
gabyx opened this issue Jun 14, 2024 · 2 comments
Open

feat: How to add HTML attributes to <code> under <pre> within Markdown #3642

gabyx opened this issue Jun 14, 2024 · 2 comments

Comments

@gabyx
Copy link

gabyx commented Jun 14, 2024

It would be extremely useful if we could add attributs to the <code> element under <pre> as like the following try:

\`\`\`cpp
int a = 3;
int a;
enum class C {A, B, C} b;
std::vector&lt;int&gt; c;

int const * & const d;

using FuncPointer  = int (*)(float); // Type: Pointer to function.
using FuncReferenz = int (&)(float); // Type: Reference to function.
using Func =             int(float); // Type: Function.
\`\`\`

<!-- .element: data-line-numbers="|3-4|8-10" data-fragment-index="1,2" -->

- This is important.
  <!-- .element: class="fragment" data-fragment-index="1" -->
- This is now important.
  <!-- .element: class="fragment" data-fragment-index="2" -->

That does not work since the data-line-numbers="|3-4|8-10" gets added to the <pre> element.
Is there already a syntax to specify a child elements, e.g. .element.code or something.
This would help in not needing to do full HTML with the code block.

@horenmar
Copy link

I am running into this often enough that I set up a small script that converts markdown code block into html.

There are similar issues with lists of non-plain elements (e.g. IIRC both Math and Code are a problem).

@gabyx
Copy link
Author

gabyx commented Jul 10, 2024

See #3655 . @horenmar maybe you know a solution?

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

2 participants