Socket
Book a DemoInstallSign in
Socket

github.com/yuin/goldmark-highlighting

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/yuin/goldmark-highlighting

v0.0.0-20220924101130-fa6e4c4a0d55
Source
Go
Version published
Created
Source

goldmark-highlighting

goldmark-highlighting is an extension for the goldmark that adds syntax-highlighting to the fenced code blocks.

goldmark-highlighting uses chroma as a syntax highlighter.

Deprecated

This branch(master) uses chroma v1 as a syntax highlighter.

Now goldmark-highlighting uses chroma v2 as a syntax highlighter and defaults to v2 branch.

Installation

go get github.com/yuin/goldmark-highlighting

Usage

import (
    "bytes"
    "fmt"
    "github.com/alecthomas/chroma/formatters/html"
    "github.com/yuin/goldmark"
    "github.com/yuin/goldmark/extension"
    "github.com/yuin/goldmark/parser"
    "github.com/yuin/goldmark-highlighting"

)

func main() {
    markdown := goldmark.New(
        goldmark.WithExtensions(
            highlighting.Highlighting,
        ),
    )
    var buf bytes.Buffer
    if err := markdown.Convert([]byte(source), &buf); err != nil {
        panic(err)
    }
    fmt.Print(title)
}
    markdown := goldmark.New(
        goldmark.WithExtensions(
            highlighting.NewHighlighting(
               highlighting.WithStyle("monokai"),
               highlighting.WithFormatOptions(
                   html.WithLineNumbers(),
               ),
            ),
        ),
    )

License

MIT

Author

Yusuke Inuzuka

FAQs

Package last updated on 24 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.