Highlighting inside fenced code block #508

Closed
opened 2026-01-29 14:38:25 +00:00 by claunia · 1 comment
Owner

Originally created by @girlpunk on GitHub (Mar 2, 2022).

Hi, Is it possible to parse formatting (specifically highlighting) within a fenced code block?

The output I'm looking for is something like this, though the exact syntax to achieve is flexable

```
code goes here, with ==something== highlighted
this would be part of a large-ish multiline block
```

image

Originally created by @girlpunk on GitHub (Mar 2, 2022). Hi, Is it possible to parse formatting (specifically highlighting) within a fenced code block? The output I'm looking for is something like this, though the exact syntax to achieve is flexable ``` code goes here, with ==something== highlighted this would be part of a large-ish multiline block ``` ![image](https://user-images.githubusercontent.com/161093/156368744-e83a2f2a-3664-4669-a825-11ff914cccc1.png)
claunia added the question label 2026-01-29 14:38:25 +00:00
Author
Owner

@xoofx commented on GitHub (Mar 3, 2022):

Hi, Is it possible to parse formatting (specifically highlighting) within a fenced code block?

No, it's not possible within Markdig (or more specifically in the scope), but you can always parse the content of code fenced yourself and do whatever you want with the content.

Syntax highlighting is a different topic and is usually handled outside of markdig, as explained in many issues (like #594). Most of the time, highlighting is done in Javascript, quite often (HTML) client side. This is how markdig is used currently by all major doc generation tool.

@xoofx commented on GitHub (Mar 3, 2022): > Hi, Is it possible to parse formatting (specifically highlighting) within a fenced code block? No, it's not possible within Markdig (or more specifically in the scope), but you can always parse the content of code fenced yourself and do whatever you want with the content. Syntax highlighting is a different topic and is usually handled outside of markdig, as explained in many issues (like #594). Most of the time, highlighting is done in Javascript, quite often (HTML) client side. This is how markdig is used currently by all major doc generation tool.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#508