mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
@@ -125,7 +125,6 @@ func (ids *idFactory) Generate(value []byte, kind ast.NodeKind) []byte {
|
||||
}
|
||||
|
||||
ids.vals[buf.String()] = struct{}{}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,6 @@ func TestSanitizeAnchorNameAsciiOnly(t *testing.T) {
|
||||
|
||||
c.Assert(sanitizeAnchorNameString("god is神真美好 good", goldmark_config.AutoHeadingIDTypeGitHubAscii), qt.Equals, "god-is-good")
|
||||
c.Assert(sanitizeAnchorNameString("Resumé", goldmark_config.AutoHeadingIDTypeGitHubAscii), qt.Equals, "resume")
|
||||
|
||||
}
|
||||
|
||||
func TestSanitizeAnchorNameBlackfriday(t *testing.T) {
|
||||
@@ -106,7 +105,6 @@ func BenchmarkSanitizeAnchorName(b *testing.B) {
|
||||
result := sanitizeAnchorName(input, goldmark_config.AutoHeadingIDTypeGitHub)
|
||||
if len(result) != 24 {
|
||||
b.Fatalf("got %d", len(result))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,7 +116,6 @@ func BenchmarkSanitizeAnchorNameAsciiOnly(b *testing.B) {
|
||||
result := sanitizeAnchorName(input, goldmark_config.AutoHeadingIDTypeGitHubAscii)
|
||||
if len(result) != 12 {
|
||||
b.Fatalf("got %d", len(result))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +127,6 @@ func BenchmarkSanitizeAnchorNameBlackfriday(b *testing.B) {
|
||||
result := sanitizeAnchorName(input, goldmark_config.AutoHeadingIDTypeBlackfriday)
|
||||
if len(result) != 24 {
|
||||
b.Fatalf("got %d", len(result))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -62,9 +62,7 @@ func (p provide) New(cfg converter.ProviderConfig) (converter.Provider, error) {
|
||||
}), nil
|
||||
}
|
||||
|
||||
var (
|
||||
_ converter.AnchorNameSanitizer = (*goldmarkConverter)(nil)
|
||||
)
|
||||
var _ converter.AnchorNameSanitizer = (*goldmarkConverter)(nil)
|
||||
|
||||
type goldmarkConverter struct {
|
||||
md goldmark.Markdown
|
||||
@@ -156,7 +154,6 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown {
|
||||
)
|
||||
|
||||
return md
|
||||
|
||||
}
|
||||
|
||||
var _ identity.IdentitiesProvider = (*converterResult)(nil)
|
||||
@@ -267,7 +264,6 @@ func (c *goldmarkConverter) Convert(ctx converter.RenderContext) (result convert
|
||||
ids: rcx.ids.GetIdentities(),
|
||||
toc: pctx.TableOfContents(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
var featureSet = map[identity.Identity]bool{
|
||||
@@ -329,7 +325,6 @@ func newHighlighting(cfg highlight.Config) goldmark.Extender {
|
||||
}
|
||||
|
||||
w.WriteString("</div>")
|
||||
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ import (
|
||||
)
|
||||
|
||||
func convert(c *qt.C, mconf markup_config.Config, content string) converter.Result {
|
||||
|
||||
p, err := Provider.New(
|
||||
converter.ProviderConfig{
|
||||
MarkupConfig: mconf,
|
||||
@@ -163,7 +162,6 @@ description
|
||||
c.Assert(ok, qt.Equals, true)
|
||||
tocHTML := toc.TableOfContents().ToHTML(1, 2, false)
|
||||
c.Assert(tocHTML, qt.Contains, "TableOfContents")
|
||||
|
||||
}
|
||||
|
||||
func TestConvertAutoIDAsciiOnly(t *testing.T) {
|
||||
@@ -212,7 +210,6 @@ func TestConvertIssues(t *testing.T) {
|
||||
|
||||
c.Assert(got, qt.Contains, "<custom-element>\n <div>This will be \"slotted\" into the custom element.</div>\n</custom-element>\n")
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestCodeFence(t *testing.T) {
|
||||
@@ -257,7 +254,6 @@ LINE5
|
||||
</code></pre></div>`)
|
||||
result = convertForConfig(c, cfg, `echo "Hugo Rocks!"`, "unknown")
|
||||
c.Assert(result, qt.Equals, "<pre><code class=\"language-unknown\" data-lang=\"unknown\">echo "Hugo Rocks!"\n</code></pre>")
|
||||
|
||||
})
|
||||
|
||||
c.Run("Highlight lines, default config", func(c *qt.C) {
|
||||
|
@@ -115,7 +115,6 @@ func (r *hookedRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
|
||||
|
||||
// https://github.com/yuin/goldmark/blob/b611cd333a492416b56aa8d94b04a67bf0096ab2/renderer/html/html.go#L404
|
||||
func (r *hookedRenderer) RenderAttributes(w util.BufWriter, node ast.Node) {
|
||||
|
||||
for _, attr := range node.Attributes() {
|
||||
_, _ = w.WriteString(" ")
|
||||
_, _ = w.Write(attr.Name)
|
||||
@@ -189,7 +188,6 @@ func (r *hookedRenderer) renderImage(w util.BufWriter, source []byte, node ast.N
|
||||
ctx.AddIdentity(h.ImageRenderer)
|
||||
|
||||
return ast.WalkContinue, err
|
||||
|
||||
}
|
||||
|
||||
// Fall back to the default Goldmark render funcs. Method below borrowed from:
|
||||
|
@@ -53,7 +53,8 @@ And then some.
|
||||
p, err := Provider.New(
|
||||
converter.ProviderConfig{
|
||||
MarkupConfig: markup_config.Default,
|
||||
Logger: loggers.NewErrorLogger()})
|
||||
Logger: loggers.NewErrorLogger(),
|
||||
})
|
||||
c.Assert(err, qt.IsNil)
|
||||
conv, err := p.New(converter.DocumentContext{})
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
Reference in New Issue
Block a user