Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
github.com/saward/mdchroma
Integrating Chroma syntax highlighter as a Go Markdown renderer.
This project requires and uses the Go Markdown package.
$ go get -u github.com/saward/mdchroma
This project uses the module approach of go 1.11
This renderer integrates chroma to highlight code with triple backtick notation. It will try to use the given language when available otherwise it will try to detect the language. If none of these two method works it will fallback to sane defaults.
This is a fork of the mdchroma package, modified to instead work with Go Markdown.
output := markdown.ToHTML(md, nil, mdchroma.NewRenderer())
package main
import (
"fmt"
chroma "github.com/saward/mdchroma"
"github.com/gomarkdown/markdown"
)
var md = "This is some sample code.\n\n```go\n" +
`func main() {
fmt.Println("Hi")
}
` + "```"
func main() {
html := markdown.ToHTML([]byte(md), nil, chroma.NewRenderer())
fmt.Println(string(html))
}
Will output :
<p>This is some sample code.</p>
<pre style="color:#f8f8f2;background-color:#272822"><span style="color:#66d9ef">func</span> <span style="color:#a6e22e">main</span>() {
<span style="color:#a6e22e">fmt</span>.<span style="color:#a6e22e">Println</span>(<span style="color:#e6db74">"Hi"</span>)
}
</pre>
FAQs
Unknown package
Did you know?
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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.