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

Can I apply a language to inline <code> blocks? #742

Open
seangwright opened this issue Oct 2, 2023 · 2 comments
Open

Can I apply a language to inline <code> blocks? #742

seangwright opened this issue Oct 2, 2023 · 2 comments
Labels

Comments

@seangwright
Copy link

Prism.js can highlight inline code blocks like `<div></div>` but a language needs to specified (the way we do for multiline fenced code blocks.

If a language is provided on the <code> element then it will be highlighted.

<code class="language-markup">
<!-- ... -->
</code>

Is there a way to specify an inline code fence language? Something like `[html]<div></div>`

If not, I supposed I just need to supply some default styles for <code> elements.

@gfoidl
Copy link
Contributor

gfoidl commented Oct 3, 2023

Does

    foo bar

    ```c#
    int answer = 42;
    ```

    baz

work for you? dotnet fiddle displays the correct html-tags.

@seangwright
Copy link
Author

That produces this:

<p>foo bar</p>

<pre class="language-csharp"><code>int answer = 42;
</code></pre>

<p>baz</p>

I want the code to be inline with the content:

<p>foo bar <code class="language-csharp">int answer = 42;</code> baz </p>

Repository owner deleted a comment Nov 25, 2023
@xoofx xoofx added the question label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants