Implements syntax highlighting and <hr> style.
This commit is contained in:
parent
e1b72ed566
commit
52f1e9c365
2 changed files with 15 additions and 5 deletions
|
|
@ -428,3 +428,12 @@ code {
|
||||||
tt {
|
tt {
|
||||||
@extend code;
|
@extend code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
background: $border-color;
|
||||||
|
height: $border-width;
|
||||||
|
margin: $unit-2 0;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import "syntax.scss";
|
||||||
|
|
@ -38,8 +38,8 @@ type
|
||||||
var docConfig: StringTableRef
|
var docConfig: StringTableRef
|
||||||
|
|
||||||
docConfig = rstgen.defaultConfig()
|
docConfig = rstgen.defaultConfig()
|
||||||
docConfig["doc.listing_start"] = "<pre class=\"listing $2\">"
|
docConfig["doc.listing_start"] = "<pre class='code' data-lang='$2'><code>"
|
||||||
docConfig["doc.smiley_format"] = "/images/smilieys/$1.png"
|
docConfig["doc.listing_end"] = "</code><div class='code-buttons'><button class='btn btn-primary btn-sm'>Run</button></div></pre>"
|
||||||
|
|
||||||
proc loadConfig*(filename = getCurrentDir() / "forum.json"): Config =
|
proc loadConfig*(filename = getCurrentDir() / "forum.json"): Config =
|
||||||
result = Config(smtpAddress: "", smtpPort: 25, smtpUser: "",
|
result = Config(smtpAddress: "", smtpPort: 25, smtpUser: "",
|
||||||
|
|
@ -81,7 +81,7 @@ proc blockquoteFinish(currentBlockquote, newNode: var XmlNode, n: XmlNode) =
|
||||||
newNode.add(n)
|
newNode.add(n)
|
||||||
|
|
||||||
proc rstToHtml*(content: string): string =
|
proc rstToHtml*(content: string): string =
|
||||||
result = rstgen.rstToHtml(content, {roSupportSmilies, roSupportMarkdown},
|
result = rstgen.rstToHtml(content, {roSupportMarkdown},
|
||||||
docConfig)
|
docConfig)
|
||||||
# Bolt on quotes.
|
# Bolt on quotes.
|
||||||
# TODO: Yes, this is ugly. I wrote it quickly. PRs welcome ;)
|
# TODO: Yes, this is ugly. I wrote it quickly. PRs welcome ;)
|
||||||
|
|
@ -116,7 +116,8 @@ proc rstToHtml*(content: string): string =
|
||||||
blockquoteFinish(currentBlockquote, newNode, n)
|
blockquoteFinish(currentBlockquote, newNode, n)
|
||||||
else:
|
else:
|
||||||
blockquoteFinish(currentBlockquote, newNode, n)
|
blockquoteFinish(currentBlockquote, newNode, n)
|
||||||
result = $newNode
|
result = ""
|
||||||
|
add(result, newNode, indWidth=0, addNewLines=false)
|
||||||
except:
|
except:
|
||||||
echo("[WARNING] Could not parse rst html.")
|
echo("[WARNING] Could not parse rst html.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue