commit 454fd51849d20e79e81c09fb2bed82438647be09
parent 8ba02222853ccb35b60a7c19c6d6f02ca5f1eb1a
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Mon, 23 Jan 2023 12:54:15 -0800
stop using this nonsense go module replace
Diffstat:
11 files changed, 177 insertions(+), 376 deletions(-)
diff --git a/go.mod b/go.mod
@@ -2,11 +2,8 @@ module dkforest
go 1.18
-replace github.com/russross/blackfriday/v2 => ./pkg/blackfriday/v2
-
require (
filippo.io/age v1.0.0
- github.com/Depado/bfchroma v0.0.0-20200630102228-8c173a3358d4
github.com/ProtonMail/go-crypto v0.0.0-20210920160938-87db9fbc61c7
github.com/alecthomas/chroma v0.9.2
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef
@@ -28,7 +25,6 @@ require (
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.3.0
github.com/rubenv/sql-migrate v0.0.0-20210215143335-f84234893558
- github.com/russross/blackfriday/v2 v2.1.0
github.com/sirupsen/logrus v1.8.0
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/stretchr/testify v1.7.0
@@ -43,6 +39,7 @@ require (
)
require (
+ github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/chris-ramon/douceur v0.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
@@ -57,6 +54,7 @@ require (
github.com/magefile/mage v1.10.0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.1.0 // indirect
diff --git a/go.sum b/go.sum
@@ -6,8 +6,6 @@ filippo.io/age v1.0.0/go.mod h1:PaX+Si/Sd5G8LgfCwldsSba3H1DDQZhIhFGkhbHaBq8=
github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/Depado/bfchroma v0.0.0-20200630102228-8c173a3358d4 h1:svz10fg1jqTYez94IRUhPhnwkA5xoCt1KlHl5FFjkk8=
-github.com/Depado/bfchroma v0.0.0-20200630102228-8c173a3358d4/go.mod h1:c0bFk0tFmT+clD3TIGurjWCfD/QV8/EebfM3JGr+98M=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/ProtonMail/go-crypto v0.0.0-20210920160938-87db9fbc61c7 h1:DSqTh6nEes/uO8BlNcGk8PzZsxY2sN9ZL//veWBdTRI=
github.com/ProtonMail/go-crypto v0.0.0-20210920160938-87db9fbc61c7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
@@ -19,7 +17,6 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia
github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
-github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
github.com/alecthomas/chroma v0.9.2 h1:yU1sE2+TZbLIQPMk30SolL2Hn53SR/Pv750f7qZ/XMs=
github.com/alecthomas/chroma v0.9.2/go.mod h1:eMuEnpA18XbG/WhOWtCzJHS7WqEtDAI+HxdwoW0nVSk=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
@@ -83,7 +80,6 @@ github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6RO
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
-github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -345,6 +341,9 @@ github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
github.com/rubenv/sql-migrate v0.0.0-20210215143335-f84234893558 h1:o8N+eY3HGAzZ+5sXNdcbCVOHW3NOksmKeEOuygusmr8=
github.com/rubenv/sql-migrate v0.0.0-20210215143335-f84234893558/go.mod h1:DCgfY80j8GYL7MLEfvcpSFvjD0L5yZq/aZUJmhZklyg=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
+github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
diff --git a/pkg/bfchroma/LICENSE b/pkg/bfchroma/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/pkg/bfchroma/renderer.go b/pkg/bfchroma/renderer.go
@@ -0,0 +1,147 @@
+// Package bfchroma provides an easy and extensible blackfriday renderer that
+// uses the chroma syntax highlighter to render code blocks.
+package bfchroma
+
+import (
+ "io"
+
+ bf "dkforest/pkg/blackfriday/v2"
+ "github.com/alecthomas/chroma"
+ "github.com/alecthomas/chroma/formatters/html"
+ "github.com/alecthomas/chroma/lexers"
+ "github.com/alecthomas/chroma/styles"
+)
+
+// Option defines the functional option type
+type Option func(r *Renderer)
+
+// Style is a function option allowing to set the style used by chroma
+// Default : "monokai"
+func Style(s string) Option {
+ return func(r *Renderer) {
+ r.Style = styles.Get(s)
+ }
+}
+
+// ChromaStyle is an option to directly set the style of the renderer using a
+// chroma style instead of a string
+func ChromaStyle(s *chroma.Style) Option {
+ return func(r *Renderer) {
+ r.Style = s
+ }
+}
+
+// WithoutAutodetect disables chroma's language detection when no codeblock
+// extra information is given. It will fallback to a sane default instead of
+// trying to detect the language.
+func WithoutAutodetect() Option {
+ return func(r *Renderer) {
+ r.Autodetect = false
+ }
+}
+
+// EmbedCSS will embed CSS needed for html.WithClasses() in beginning of the document
+func EmbedCSS() Option {
+ return func(r *Renderer) {
+ r.embedCSS = true
+ }
+}
+
+// ChromaOptions allows to pass Chroma html.Option such as Standalone()
+// WithClasses(), ClassPrefix(prefix)...
+func ChromaOptions(options ...html.Option) Option {
+ return func(r *Renderer) {
+ r.ChromaOptions = options
+ }
+}
+
+// Extend allows to specify the blackfriday renderer which is extended
+func Extend(br bf.Renderer) Option {
+ return func(r *Renderer) {
+ r.Base = br
+ }
+}
+
+// NewRenderer will return a new bfchroma renderer with sane defaults
+func NewRenderer(options ...Option) *Renderer {
+ r := &Renderer{
+ Base: bf.NewHTMLRenderer(bf.HTMLRendererParameters{
+ Flags: bf.CommonHTMLFlags,
+ }),
+ Style: styles.Monokai,
+ Autodetect: true,
+ }
+ for _, option := range options {
+ option(r)
+ }
+ r.Formatter = html.New(r.ChromaOptions...)
+ return r
+}
+
+// RenderWithChroma will render the given text to the w io.Writer
+func (r *Renderer) RenderWithChroma(w io.Writer, text []byte, data bf.CodeBlockData) error {
+ var lexer chroma.Lexer
+
+ // Determining the lexer to use
+ if len(data.Info) > 0 {
+ lexer = lexers.Get(string(data.Info))
+ } else if r.Autodetect {
+ lexer = lexers.Analyse(string(text))
+ }
+ if lexer == nil {
+ lexer = lexers.Fallback
+ }
+
+ // Tokenize the code
+ iterator, err := lexer.Tokenise(nil, string(text))
+ if err != nil {
+ return err
+ }
+ return r.Formatter.Format(w, r.Style, iterator)
+}
+
+// Renderer is a custom Blackfriday renderer that uses the capabilities of
+// chroma to highlight code with triple backtick notation
+type Renderer struct {
+ Base bf.Renderer
+ Autodetect bool
+ ChromaOptions []html.Option
+ Style *chroma.Style
+ Formatter *html.Formatter
+ embedCSS bool
+}
+
+// RenderNode satisfies the Renderer interface
+func (r *Renderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf.WalkStatus {
+ switch node.Type {
+ case bf.Document:
+ if entering && r.embedCSS {
+ w.Write([]byte("<style>"))
+ r.Formatter.WriteCSS(w, r.Style)
+ w.Write([]byte("</style>"))
+ }
+ return r.Base.RenderNode(w, node, entering)
+ case bf.CodeBlock:
+ if err := r.RenderWithChroma(w, node.Literal, node.CodeBlockData); err != nil {
+ return r.Base.RenderNode(w, node, entering)
+ }
+ return bf.SkipChildren
+ default:
+ return r.Base.RenderNode(w, node, entering)
+ }
+}
+
+// RenderHeader satisfies the Renderer interface
+func (r *Renderer) RenderHeader(w io.Writer, ast *bf.Node) {
+ r.Base.RenderHeader(w, ast)
+}
+
+// RenderFooter satisfies the Renderer interface
+func (r *Renderer) RenderFooter(w io.Writer, ast *bf.Node) {
+ r.Base.RenderFooter(w, ast)
+}
+
+// ChromaCSS returns CSS used with chroma's html.WithClasses() option
+func (r *Renderer) ChromaCSS(w io.Writer) error {
+ return r.Formatter.WriteCSS(w, r.Style)
+}
diff --git a/pkg/blackfriday/v2/.gitignore b/pkg/blackfriday/v2/.gitignore
@@ -1,8 +0,0 @@
-*.out
-*.swp
-*.8
-*.6
-_obj
-_test*
-markdown
-tags
diff --git a/pkg/blackfriday/v2/.travis.yml b/pkg/blackfriday/v2/.travis.yml
@@ -1,17 +0,0 @@
-sudo: false
-language: go
-go:
- - "1.10.x"
- - "1.11.x"
- - tip
-matrix:
- fast_finish: true
- allow_failures:
- - go: tip
-install:
- - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
-script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d -s .)
- - go tool vet .
- - go test -v ./...
diff --git a/pkg/blackfriday/v2/README.md b/pkg/blackfriday/v2/README.md
@@ -1,335 +0,0 @@
-Blackfriday
-[![Build Status][BuildV2SVG]][BuildV2URL]
-[![PkgGoDev][PkgGoDevV2SVG]][PkgGoDevV2URL]
-===========
-
-Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
-is paranoid about its input (so you can safely feed it user-supplied
-data), it is fast, it supports common extensions (tables, smart
-punctuation substitutions, etc.), and it is safe for all utf-8
-(unicode) input.
-
-HTML output is currently supported, along with Smartypants
-extensions.
-
-It started as a translation from C of [Sundown][3].
-
-
-Installation
-------------
-
-Blackfriday is compatible with modern Go releases in module mode.
-With Go installed:
-
- go get github.com/russross/blackfriday/v2
-
-will resolve and add the package to the current development module,
-then build and install it. Alternatively, you can achieve the same
-if you import it in a package:
-
- import "github.com/russross/blackfriday/v2"
-
-and `go get` without parameters.
-
-Legacy GOPATH mode is unsupported.
-
-
-Versions
---------
-
-Currently maintained and recommended version of Blackfriday is `v2`. It's being
-developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
-documentation is available at
-https://pkg.go.dev/github.com/russross/blackfriday/v2.
-
-It is `go get`-able in module mode at `github.com/russross/blackfriday/v2`.
-
-Version 2 offers a number of improvements over v1:
-
-* Cleaned up API
-* A separate call to [`Parse`][4], which produces an abstract syntax tree for
- the document
-* Latest bug fixes
-* Flexibility to easily add your own rendering extensions
-
-Potential drawbacks:
-
-* Our benchmarks show v2 to be slightly slower than v1. Currently in the
- ballpark of around 15%.
-* API breakage. If you can't afford modifying your code to adhere to the new API
- and don't care too much about the new features, v2 is probably not for you.
-* Several bug fixes are trailing behind and still need to be forward-ported to
- v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
- tracking.
-
-If you are still interested in the legacy `v1`, you can import it from
-`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
-here: https://pkg.go.dev/github.com/russross/blackfriday.
-
-
-Usage
------
-
-For the most sensible markdown processing, it is as simple as getting your input
-into a byte slice and calling:
-
-```go
-output := blackfriday.Run(input)
-```
-
-Your input will be parsed and the output rendered with a set of most popular
-extensions enabled. If you want the most basic feature set, corresponding with
-the bare Markdown specification, use:
-
-```go
-output := blackfriday.Run(input, blackfriday.WithNoExtensions())
-```
-
-### Sanitize untrusted content
-
-Blackfriday itself does nothing to protect against malicious content. If you are
-dealing with user-supplied markdown, we recommend running Blackfriday's output
-through HTML sanitizer such as [Bluemonday][5].
-
-Here's an example of simple usage of Blackfriday together with Bluemonday:
-
-```go
-import (
- "github.com/microcosm-cc/bluemonday"
- "github.com/russross/blackfriday/v2"
-)
-
-// ...
-unsafe := blackfriday.Run(input)
-html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
-```
-
-### Custom options
-
-If you want to customize the set of options, use `blackfriday.WithExtensions`,
-`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
-
-### `blackfriday-tool`
-
-You can also check out `blackfriday-tool` for a more complete example
-of how to use it. Download and install it using:
-
- go get github.com/russross/blackfriday-tool
-
-This is a simple command-line tool that allows you to process a
-markdown file using a standalone program. You can also browse the
-source directly on github if you are just looking for some example
-code:
-
-* <https://github.com/russross/blackfriday-tool>
-
-Note that if you have not already done so, installing
-`blackfriday-tool` will be sufficient to download and install
-blackfriday in addition to the tool itself. The tool binary will be
-installed in `$GOPATH/bin`. This is a statically-linked binary that
-can be copied to wherever you need it without worrying about
-dependencies and library versions.
-
-### Sanitized anchor names
-
-Blackfriday includes an algorithm for creating sanitized anchor names
-corresponding to a given input text. This algorithm is used to create
-anchors for headings when `AutoHeadingIDs` extension is enabled. The
-algorithm has a specification, so that other packages can create
-compatible anchor names and links to those anchors.
-
-The specification is located at https://pkg.go.dev/github.com/russross/blackfriday/v2#hdr-Sanitized_Anchor_Names.
-
-[`SanitizedAnchorName`](https://pkg.go.dev/github.com/russross/blackfriday/v2#SanitizedAnchorName) exposes this functionality, and can be used to
-create compatible links to the anchor names generated by blackfriday.
-This algorithm is also implemented in a small standalone package at
-[`github.com/shurcooL/sanitized_anchor_name`](https://pkg.go.dev/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
-that want a small package and don't need full functionality of blackfriday.
-
-
-Features
---------
-
-All features of Sundown are supported, including:
-
-* **Compatibility**. The Markdown v1.0.3 test suite passes with
- the `--tidy` option. Without `--tidy`, the differences are
- mostly in whitespace and entity escaping, where blackfriday is
- more consistent and cleaner.
-
-* **Common extensions**, including table support, fenced code
- blocks, autolinks, strikethroughs, non-strict emphasis, etc.
-
-* **Safety**. Blackfriday is paranoid when parsing, making it safe
- to feed untrusted user input without fear of bad things
- happening. The test suite stress tests this and there are no
- known inputs that make it crash. If you find one, please let me
- know and send me the input that does it.
-
- NOTE: "safety" in this context means *runtime safety only*. In order to
- protect yourself against JavaScript injection in untrusted content, see
- [this example](https://github.com/russross/blackfriday#sanitize-untrusted-content).
-
-* **Fast processing**. It is fast enough to render on-demand in
- most web applications without having to cache the output.
-
-* **Thread safety**. You can run multiple parsers in different
- goroutines without ill effect. There is no dependence on global
- shared state.
-
-* **Minimal dependencies**. Blackfriday only depends on standard
- library packages in Go. The source code is pretty
- self-contained, so it is easy to add to any project, including
- Google App Engine projects.
-
-* **Standards compliant**. Output successfully validates using the
- W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional.
-
-
-Extensions
-----------
-
-In addition to the standard markdown syntax, this package
-implements the following extensions:
-
-* **Intra-word emphasis supression**. The `_` character is
- commonly used inside words when discussing code, so having
- markdown interpret it as an emphasis command is usually the
- wrong thing. Blackfriday lets you treat all emphasis markers as
- normal characters when they occur inside a word.
-
-* **Tables**. Tables can be created by drawing them in the input
- using a simple syntax:
-
- ```
- Name | Age
- --------|------
- Bob | 27
- Alice | 23
- ```
-
-* **Fenced code blocks**. In addition to the normal 4-space
- indentation to mark code blocks, you can explicitly mark them
- and supply a language (to make syntax highlighting simple). Just
- mark it like this:
-
- ```go
- func getTrue() bool {
- return true
- }
- ```
-
- You can use 3 or more backticks to mark the beginning of the
- block, and the same number to mark the end of the block.
-
- To preserve classes of fenced code blocks while using the bluemonday
- HTML sanitizer, use the following policy:
-
- ```go
- p := bluemonday.UGCPolicy()
- p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
- html := p.SanitizeBytes(unsafe)
- ```
-
-* **Definition lists**. A simple definition list is made of a single-line
- term followed by a colon and the definition for that term.
-
- Cat
- : Fluffy animal everyone likes
-
- Internet
- : Vector of transmission for pictures of cats
-
- Terms must be separated from the previous definition by a blank line.
-
-* **Footnotes**. A marker in the text that will become a superscript number;
- a footnote definition that will be placed in a list of footnotes at the
- end of the document. A footnote looks like this:
-
- This is a footnote.[^1]
-
- [^1]: the footnote text.
-
-* **Autolinking**. Blackfriday can find URLs that have not been
- explicitly marked as links and turn them into links.
-
-* **Strikethrough**. Use two tildes (`~~`) to mark text that
- should be crossed out.
-
-* **Hard line breaks**. With this extension enabled newlines in the input
- translate into line breaks in the output. This extension is off by default.
-
-* **Smart quotes**. Smartypants-style punctuation substitution is
- supported, turning normal double- and single-quote marks into
- curly quotes, etc.
-
-* **LaTeX-style dash parsing** is an additional option, where `--`
- is translated into `–`, and `---` is translated into
- `—`. This differs from most smartypants processors, which
- turn a single hyphen into an ndash and a double hyphen into an
- mdash.
-
-* **Smart fractions**, where anything that looks like a fraction
- is translated into suitable HTML (instead of just a few special
- cases like most smartypant processors). For example, `4/5`
- becomes `<sup>4</sup>⁄<sub>5</sub>`, which renders as
- <sup>4</sup>⁄<sub>5</sub>.
-
-
-Other renderers
----------------
-
-Blackfriday is structured to allow alternative rendering engines. Here
-are a few of note:
-
-* [github_flavored_markdown](https://pkg.go.dev/github.com/shurcooL/github_flavored_markdown):
- provides a GitHub Flavored Markdown renderer with fenced code block
- highlighting, clickable heading anchor links.
-
- It's not customizable, and its goal is to produce HTML output
- equivalent to the [GitHub Markdown API endpoint](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode),
- except the rendering is performed locally.
-
-* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
- but for markdown.
-
-* [LaTeX output](https://gitlab.com/ambrevar/blackfriday-latex):
- renders output as LaTeX.
-
-* [bfchroma](https://github.com/Depado/bfchroma/): provides convenience
- integration with the [Chroma](https://github.com/alecthomas/chroma) code
- highlighting library. bfchroma is only compatible with v2 of Blackfriday and
- provides a drop-in renderer ready to use with Blackfriday, as well as
- options and means for further customization.
-
-* [Blackfriday-Confluence](https://github.com/kentaro-m/blackfriday-confluence): provides a [Confluence Wiki Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) renderer.
-
-* [Blackfriday-Slack](https://github.com/karriereat/blackfriday-slack): converts markdown to slack message style
-
-
-TODO
-----
-
-* More unit testing
-* Improve Unicode support. It does not understand all Unicode
- rules (about what constitutes a letter, a punctuation symbol,
- etc.), so it may fail to detect word boundaries correctly in
- some instances. It is safe on all UTF-8 input.
-
-
-License
--------
-
-[Blackfriday is distributed under the Simplified BSD License](LICENSE.txt)
-
-
- [1]: https://daringfireball.net/projects/markdown/ "Markdown"
- [2]: https://golang.org/ "Go Language"
- [3]: https://github.com/vmg/sundown "Sundown"
- [4]: https://pkg.go.dev/github.com/russross/blackfriday/v2#Parse "Parse func"
- [5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
-
- [BuildV2SVG]: https://travis-ci.org/russross/blackfriday.svg?branch=v2
- [BuildV2URL]: https://travis-ci.org/russross/blackfriday
- [PkgGoDevV2SVG]: https://pkg.go.dev/badge/github.com/russross/blackfriday/v2
- [PkgGoDevV2URL]: https://pkg.go.dev/github.com/russross/blackfriday/v2
diff --git a/pkg/blackfriday/v2/go.mod b/pkg/blackfriday/v2/go.mod
@@ -1,3 +0,0 @@
-module blackfriday
-
-go 1.18
-\ No newline at end of file
diff --git a/pkg/database/table_forum_threads.go b/pkg/database/table_forum_threads.go
@@ -9,7 +9,7 @@ import (
"github.com/sirupsen/logrus"
- bf "github.com/russross/blackfriday/v2"
+ bf "dkforest/pkg/blackfriday/v2"
)
type ForumCategoryID int64
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
@@ -11,19 +11,19 @@ import (
"crypto/sha256"
"crypto/sha512"
"crypto/x509"
+ "dkforest/pkg/bfchroma"
+ bf "dkforest/pkg/blackfriday/v2"
"encoding/binary"
"encoding/hex"
"encoding/json"
"encoding/pem"
"errors"
"fmt"
- "github.com/Depado/bfchroma"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/ProtonMail/go-crypto/openpgp/armor"
"github.com/ProtonMail/go-crypto/openpgp/packet"
"github.com/alecthomas/chroma/formatters/html"
"github.com/asaskevich/govalidator"
- bf "github.com/russross/blackfriday/v2"
html2 "html"
"image"
"image/jpeg"
diff --git a/pkg/web/handlers/api/v1/topBarHandler.go b/pkg/web/handlers/api/v1/topBarHandler.go
@@ -1,6 +1,7 @@
package v1
import (
+ bf "dkforest/pkg/blackfriday/v2"
"dkforest/pkg/clockwork"
"dkforest/pkg/config"
"dkforest/pkg/database"
@@ -12,7 +13,6 @@ import (
"github.com/dustin/go-humanize"
"github.com/labstack/echo"
"github.com/microcosm-cc/bluemonday"
- bf "github.com/russross/blackfriday/v2"
html2 "html"
"net/http"
"net/url"