mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 07:18:54 +00:00
@@ -147,6 +147,12 @@ title: "p1"
|
||||
fmt.Println("Hello, World!");
|
||||
§§§
|
||||
|
||||
## Plain Code
|
||||
|
||||
§§§
|
||||
plain <code> & text
|
||||
§§§
|
||||
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
@@ -154,6 +160,8 @@ fmt.Println("Hello, World!");
|
||||
b.AssertFileContent("public/p1/index.html",
|
||||
"Inner: |<span class=\"line\"><span class=\"cl\"><span class=\"nx\">fmt</span><span class=\"p\">.</span><span class=\"nf\">Println</span><span class=\"p\">(</span><span class=\"s\">"Hello, World!"</span><span class=\"p\">);</span></span></span>|",
|
||||
"Wrapped: |<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-go\" data-lang=\"go\"><span class=\"line\"><span class=\"cl\"><span class=\"nx\">fmt</span><span class=\"p\">.</span><span class=\"nf\">Println</span><span class=\"p\">(</span><span class=\"s\">"Hello, World!"</span><span class=\"p\">);</span></span></span></code></pre></div>|",
|
||||
"Inner: |plain <code> & text|",
|
||||
"Wrapped: |<pre tabindex=\"0\"><code>plain <code> & text</code></pre>|",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -181,13 +181,14 @@ func highlight(fw hugio.FlexiWriter, code, lang string, attributes []attributes.
|
||||
if lexer == nil {
|
||||
if cfg.Hl_inline {
|
||||
fmt.Fprintf(w, "<code%s>%s</code>", inlineCodeAttrs(lang), gohtml.EscapeString(code))
|
||||
} else {
|
||||
preWrapper := getPreWrapper(lang, w)
|
||||
fmt.Fprint(w, preWrapper.Start(true, ""))
|
||||
fmt.Fprint(w, gohtml.EscapeString(code))
|
||||
fmt.Fprint(w, preWrapper.End(true))
|
||||
return 0, 0, nil
|
||||
}
|
||||
return 0, 0, nil
|
||||
|
||||
preWrapper := getPreWrapper(lang, w)
|
||||
fmt.Fprint(w, preWrapper.Start(true, ""))
|
||||
fmt.Fprint(w, gohtml.EscapeString(code))
|
||||
fmt.Fprint(w, preWrapper.End(true))
|
||||
return preWrapper.low, preWrapper.high, nil
|
||||
}
|
||||
|
||||
style := styles.Get(cfg.Style)
|
||||
|
||||
Reference in New Issue
Block a user