Files
hinode/content/nl/blog/code-highlighting.md
2022-12-09 06:05:56 +01:00

1.6 KiB

author, slug, title, date, description, tags, thumbnail, photoCredits, photoSource
author slug title date description tags thumbnail photoCredits photoSource
Mark Dumay code-markeren Code markeren 2022-04-16 Voorbeelden om de syntax van een taal te markeren.
code
img/notepad.jpg <a href="https://unsplash.com/@frederickjmedina">Frederick Medina</a> <a href="https://unsplash.com/photos/PdfRE-xB--s">Unsplash</a>

Code Fencing

Gebruik code fencing om de syntax voor een specifieke taal te markeren.

{
  "version": "0.2.0",
  "themes": [],
  "projects": [],
  "configuration": {}
}
<div class="highlight">
    <pre>
        <code>some code...</code>
    </pre>
</div>

Highlight Shortcode

Gebruik de highlight shortcode om de lay-out van een taalfragment aan te passen.

{{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}} // GetTitleFunc returns a func that can be used to transform a string to // title case. // // The supported styles are // // - "Go" (strings.Title) // - "AP" (see https://www.apstylebook.com/) // - "Chicago" (see https://www.chicagomanualofstyle.org/home.html) // // If an unknown or empty style is provided, AP style is what you get. func GetTitleFunc(style string) func(s string) string { switch strings.ToLower(style) { case "go": return strings.Title case "chicago": return transform.NewTitleConverter(transform.ChicagoStyle) default: return transform.NewTitleConverter(transform.APStyle) } } {{< / highlight >}}