Change CSS class name

main
Leonid Maslakov 5 months ago
parent 716e995afb
commit 8bea5b38e0
  1. 16
      README.md
  2. 18
      highlight.go
  3. 2
      highlight_dockerfile_test.go
  4. 2
      highlight_python_test.go
  5. 2
      highlight_robotstxt_test.go

@ -40,16 +40,16 @@ Host: https://mirror.example.org
After highlighting:
```html
<span class='code-k'>User-agent:</span> * <span class='code-c'># comment</span>
<span class='code-k'>Disallow:</span> /faq
<span class='code-keyword'>User-agent:</span> * <span class='code-c'># comment</span>
<span class='code-keyword'>Disallow:</span> /faq
<span class='code-c'># comment 1</span>
<span class='code-c'># comment 2</span>
<span class='code-comment'># comment 1</span>
<span class='code-comment'># comment 2</span>
<span class='code-k'>Allow:</span> /
<span class='code-k'>Crawl-delay:</span> 10
<span class='code-k'>Sitemap:</span> https://example.org/sitemap.xml
<span class='code-k'>Host:</span> https://mirror.example.org
<span class='code-keyword'>Allow:</span> /
<span class='code-keyword'>Crawl-delay:</span> 10
<span class='code-keyword'>Sitemap:</span> https://example.org/sitemap.xml
<span class='code-keyword'>Host:</span> https://mirror.example.org
```

@ -27,16 +27,16 @@ import (
// that will be assigned to the HTML tag '<span>'.
//
// Examples:
// <span style='code-k'>User-Agent:</span>
// <span style='code-c'># My comment</span>
// <span style='code-keyword'>User-Agent:</span>
// <span style='code-comment'># My comment</span>
const (
StyleKeyword = "code-k"
StyleOperator = "code-o"
StyleVarType = "code-vt"
StyleBuildInVar = "code-bi-v"
StyleBuildInFunc = "code-bi-f"
StyleComment = "code-c"
StyleBrackets = "code-b"
StyleKeyword = "code-keyword"
StyleOperator = "code-operator"
StyleVarType = "code-var-type"
StyleBuildInVar = "code-build-in-var"
StyleBuildInFunc = "code-build-in-func"
StyleComment = "code-comment"
StyleBrackets = "code-brackets"
)
// ByName helps to highlight code based on the language name.

@ -51,7 +51,7 @@ FROMalpine
# RUN rf -rf /
`,
ExpectResult: `
<span class='code-c'># RUN rf -rf /</span>
<span class='` + StyleComment + `'># RUN rf -rf /</span>
`,
},
{

@ -85,7 +85,7 @@ if __name__ == "__main__":
This is test.
"""</span>
<span class='` + StyleKeyword + `'>def</span> main() -&gt <span class='code-k'>None</span>:
<span class='` + StyleKeyword + `'>def</span> main() -&gt <span class='` + StyleKeyword + `'>None</span>:
name <span class='` + StyleOperator + `'>=</span> <span class='` + StyleBuildInFunc + `'>input</span>(<span class='` + StyleBrackets + `'>"Your name:"</span>)
<span class='` + StyleKeyword + `'>if</span> name <span class='` + StyleOperator + `'>==</span> <span class='` + StyleBrackets + `'>"Ivan"</span> <span class='` + StyleKeyword + `'>or</span> name <span class='` + StyleOperator + `'>==</span> <span class='` + StyleBrackets + `'>"Nikolai"</span>:

@ -51,7 +51,7 @@ test
# Allow:
`,
ExpectResult: `
<span class='code-c'># Allow:</span>
<span class='` + StyleComment + `'># Allow:</span>
`,
},
{

Loading…
Cancel
Save