More formatting
This commit is contained in:
@@ -49,5 +49,8 @@ main :: proc() {
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
H_2_O_4_U is uranium peroxide
|
||||||
|
Here is some __underlined__ text
|
||||||
|
|
||||||
[&1] Ordered list item 2 not included
|
[&1] Ordered list item 2 not included
|
||||||
[&named] This is the definition for a named footnote
|
[&named] This is the definition for a named footnote
|
||||||
|
|||||||
@@ -213,6 +213,27 @@ print_html :: proc(token: ^Token) {
|
|||||||
case TokenType.HorizontalRule:
|
case TokenType.HorizontalRule:
|
||||||
fmt.print("<hr>\n")
|
fmt.print("<hr>\n")
|
||||||
|
|
||||||
|
case TokenType.Underline:
|
||||||
|
fmt.print("<u>")
|
||||||
|
for child in token.children {
|
||||||
|
print_html(child)
|
||||||
|
}
|
||||||
|
fmt.print("</u>")
|
||||||
|
|
||||||
|
case TokenType.Superscript:
|
||||||
|
fmt.print("<sup>")
|
||||||
|
for child in token.children {
|
||||||
|
print_html(child)
|
||||||
|
}
|
||||||
|
fmt.print("</sup>")
|
||||||
|
|
||||||
|
case TokenType.Subscript:
|
||||||
|
fmt.print("<sub>")
|
||||||
|
for child in token.children {
|
||||||
|
print_html(child)
|
||||||
|
}
|
||||||
|
fmt.print("</sub>")
|
||||||
|
|
||||||
case TokenType.BreakLine:
|
case TokenType.BreakLine:
|
||||||
fmt.print("<br>\n")
|
fmt.print("<br>\n")
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,12 @@ print_token :: proc(token: ^Token, depth: int = 0) {
|
|||||||
type_str = "InlineCode"
|
type_str = "InlineCode"
|
||||||
case TokenType.HorizontalRule:
|
case TokenType.HorizontalRule:
|
||||||
type_str = "HorizontalRule"
|
type_str = "HorizontalRule"
|
||||||
|
case TokenType.Underline:
|
||||||
|
type_str = "Underline"
|
||||||
|
case TokenType.Superscript:
|
||||||
|
type_str = "Superscript"
|
||||||
|
case TokenType.Subscript:
|
||||||
|
type_str = "Subscript"
|
||||||
}
|
}
|
||||||
|
|
||||||
value_str := ""
|
value_str := ""
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ TokenType :: enum {
|
|||||||
CodeBlock,
|
CodeBlock,
|
||||||
InlineCode,
|
InlineCode,
|
||||||
HorizontalRule,
|
HorizontalRule,
|
||||||
|
Underline,
|
||||||
|
Superscript,
|
||||||
|
Subscript,
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenValue :: union {
|
TokenValue :: union {
|
||||||
@@ -258,6 +261,8 @@ pass_through_children :: proc(token: ^Token) {
|
|||||||
parse_inline_style(token, '*', []StyleToggle{{2, .Bold}, {1, .Italics}})
|
parse_inline_style(token, '*', []StyleToggle{{2, .Bold}, {1, .Italics}})
|
||||||
parse_inline_style(token, '~', []StyleToggle{{2, .Strikethrough}})
|
parse_inline_style(token, '~', []StyleToggle{{2, .Strikethrough}})
|
||||||
parse_inline_style(token, '-', []StyleToggle{{2, .Strikethrough}})
|
parse_inline_style(token, '-', []StyleToggle{{2, .Strikethrough}})
|
||||||
|
parse_inline_style(token, '^', []StyleToggle{{1, .Superscript}})
|
||||||
|
parse_inline_style(token, '_', []StyleToggle{{2, .Underline}, {1, .Subscript}})
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_inline_code :: proc(token: ^Token) {
|
parse_inline_code :: proc(token: ^Token) {
|
||||||
|
|||||||
Reference in New Issue
Block a user