Is there a hook to render inline Markdown code

Hi, I’m able to highlight inline code as follows.

The {{< highlight python "hl_inline=true" >}}range(){{< /highlight >}} function is used to generate a sequence of numbers.

I’m wondering if there is a hook for Markdown inline code, so that we can make the syntax shorter, for example.

The `#!python range()` function is used to generate a sequence of numbers.
  • #! just like a notation as shell script.

I tried the render-codeblock.html hook, but seems not for Markdown inline code.

If there is not, would this hook be considered as a feature request?

1 Like

checkout RenderString and RenderShortcodes

Thanks, but seems not what I am looking for, I wish write Markdown without shortcode directly.

No.

Considered? Yes. Will it actually happen? Maybe. I’d log an issue, but keep it simple. The hook should only receive context .Text and .Page. Parsing .Text to determine the highlight language is up to you; that way you can get clever and do something like (pseudo code)…

{{ $lang := or 
  (lang as specified at beginning of .Text)
  (.Page.Param "defaultCodeLang")
  "text"
}}
2 Likes

Thanks for considering this feature.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.