How highlight markdown inline code? #3273
-
I see from the official documentation that using markdown will highlight inline code. <head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/prism-okaidia.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/plugins/match-braces/prism-match-braces.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/plugins/line-numbers/prism-line-numbers.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/plugins/show-invisibles/prism-show-invisibles.min.css">
</head>
<body>
<pre class="line-numbers language-markdown"><code>
`ShowPay()`
```csharp
using System;
using System.Threading.Tasks;
using Dpz.Core.WebMore.Models;
using Dpz.Core.WebMore.Service;
using Dpz.Core.WebMore.Shared;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using Microsoft.JSInterop;
using MudBlazor;```
</code></pre>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/match-braces/prism-match-braces.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/show-language/prism-show-language.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/show-invisibles/prism-show-invisibles.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script>
</body> Execute What should I do to highlight this C# code? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I looked into it, and it doesn't work for 2 reasons:
Not loading Show Invisibles makes Markdown's code highlighting work again, but that might not be an acceptable workaround for you. Until #1609 is fixed, there is nothing we can do for you, unfortunately. |
Beta Was this translation helpful? Give feedback.
I looked into it, and it doesn't work for 2 reasons:
The easy: Your code block is invalid. The closing backticks have to be on a separate line.
The hard: Markdowns code highlighting seems to be incompatible with Show invisibles.
I theorized that this might become a problem (#1609) but it never happened until now.
Not loading Show Invisibles makes Markdown's code highlighting work again, but that might not be an acceptable workaround for you.
Until #1609 is fixed, there is nothing we can do for you, unfortunately.