Skip to content

Add a hook to render/highlight Markdown inline code #12307

Open
@razonyang

Description

@razonyang

Currently, we're able to highlight inline code via shortcode as follows.

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

We can make this usage shorter without shortcode if support a hook to render inline code like render-codeblock does.

// theme's scoped custom hook
{{ $code := .Text }}
{{ if strings.HasPrefix "#!" }}
  {{ highlight ... }}
{{ else }}
  <code>{{ $code }}</code>
{{ end }}
The `#!python range()` function is used to generate a sequence of numbers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions