Skip to content

Possibility to render html in code block #657

@chenbin11200

Description

@chenbin11200

I would like to mark some codes in the code block by using HTML inline style, e.g. define background color for a piece of code.

<span style="background-color:#FFFF00">codes I want to emphasise.</span>

This is normally supported, even in quote block it works, but not in code block. In order to achieve that, I could use:

<pre>
<code>This is my <span style="background-color:#FFFF00">code.</span>
</code>
</pre>

Well, you can not see the "correct" result in github, but I believe you understand what is expected result. But in this way, it will overwrite the code highlight feature in code block.
I understand that, the codes in the code block will/should be escaped, because there exists some programming languages, such as HTML.
How about define a second parameter for the code block? For example, if I define a code block by ```java renderHTML, then the HTML code will not be escaped in the code block, and will be rendered correctly as HTML code, then one can take advantage of hundreds HTML/CSS styling features in code block?

This feature might be discussed before, but I didn't really find a good solution. If there is a way, would you mind tell me how to achieve this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions