mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Rename Prefix|Suffix & Styled[Prefix|Suffix] => Block[Prefix|Suffix] & Prefix|Suffix
This commit is contained in:
+4
-4
@@ -146,15 +146,15 @@ func (e *BaseElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
|
|
||||||
rules := bs.With(e.Style)
|
rules := bs.With(e.Style)
|
||||||
// render unstyled prefix/suffix
|
// render unstyled prefix/suffix
|
||||||
renderText(w, bs.Current().Style.StylePrimitive, rules.Prefix)
|
renderText(w, bs.Current().Style.StylePrimitive, rules.BlockPrefix)
|
||||||
defer func() {
|
defer func() {
|
||||||
renderText(w, bs.Current().Style.StylePrimitive, rules.Suffix)
|
renderText(w, bs.Current().Style.StylePrimitive, rules.BlockSuffix)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// render styled prefix/suffix
|
// render styled prefix/suffix
|
||||||
renderText(w, rules, rules.StyledPrefix)
|
renderText(w, rules, rules.Prefix)
|
||||||
defer func() {
|
defer func() {
|
||||||
renderText(w, rules, rules.StyledSuffix)
|
renderText(w, rules, rules.Suffix)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
s := e.Token
|
s := e.Token
|
||||||
|
|||||||
+4
-4
@@ -18,8 +18,8 @@ func (e *BlockElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
bs := ctx.blockStack
|
bs := ctx.blockStack
|
||||||
bs.Push(*e)
|
bs.Push(*e)
|
||||||
|
|
||||||
renderText(w, bs.Parent().Style.StylePrimitive, e.Style.Prefix)
|
renderText(w, bs.Parent().Style.StylePrimitive, e.Style.BlockPrefix)
|
||||||
renderText(bs.Current().Block, bs.Current().Style.StylePrimitive, e.Style.StyledPrefix)
|
renderText(bs.Current().Block, bs.Current().Style.StylePrimitive, e.Style.Prefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,8 +47,8 @@ func (e *BlockElement) Finish(w io.Writer, ctx RenderContext) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderText(w, bs.Current().Style.StylePrimitive, e.Style.StyledSuffix)
|
renderText(w, bs.Current().Style.StylePrimitive, e.Style.Suffix)
|
||||||
renderText(w, bs.Parent().Style.StylePrimitive, e.Style.Suffix)
|
renderText(w, bs.Parent().Style.StylePrimitive, e.Style.BlockSuffix)
|
||||||
|
|
||||||
bs.Current().Block.Reset()
|
bs.Current().Block.Reset()
|
||||||
bs.Pop()
|
bs.Pop()
|
||||||
|
|||||||
+2
-2
@@ -36,9 +36,9 @@ func (e *CodeBlockElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(theme) > 0 {
|
if len(theme) > 0 {
|
||||||
renderText(iw, bs.Current().Style.StylePrimitive, rules.Prefix)
|
renderText(iw, bs.Current().Style.StylePrimitive, rules.BlockPrefix)
|
||||||
err := quick.Highlight(iw, e.Code, e.Language, "terminal16m", theme)
|
err := quick.Highlight(iw, e.Code, e.Language, "terminal16m", theme)
|
||||||
renderText(iw, bs.Current().Style.StylePrimitive, rules.Suffix)
|
renderText(iw, bs.Current().Style.StylePrimitive, rules.BlockSuffix)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -41,8 +41,8 @@ func (e *HeadingElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
}
|
}
|
||||||
bs.Push(be)
|
bs.Push(be)
|
||||||
|
|
||||||
renderText(w, bs.Parent().Style.StylePrimitive, rules.Prefix)
|
renderText(w, bs.Parent().Style.StylePrimitive, rules.BlockPrefix)
|
||||||
renderText(bs.Current().Block, bs.Current().Style.StylePrimitive, rules.StyledPrefix)
|
renderText(bs.Current().Block, bs.Current().Style.StylePrimitive, rules.Prefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,8 +81,8 @@ func (e *HeadingElement) Finish(w io.Writer, ctx RenderContext) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
renderText(w, bs.Current().Style.StylePrimitive, rules.StyledSuffix)
|
renderText(w, bs.Current().Style.StylePrimitive, rules.Suffix)
|
||||||
renderText(w, bs.Parent().Style.StylePrimitive, rules.Suffix)
|
renderText(w, bs.Parent().Style.StylePrimitive, rules.BlockSuffix)
|
||||||
|
|
||||||
bs.Current().Block.Reset()
|
bs.Current().Block.Reset()
|
||||||
bs.Pop()
|
bs.Pop()
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ func (e *LinkElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
style := ctx.styles.Link
|
style := ctx.styles.Link
|
||||||
if !textRendered {
|
if !textRendered {
|
||||||
pre = ""
|
pre = ""
|
||||||
style.Prefix = ""
|
style.BlockPrefix = ""
|
||||||
style.Suffix = ""
|
style.BlockSuffix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
el := &BaseElement{
|
el := &BaseElement{
|
||||||
|
|||||||
+4
-4
@@ -22,8 +22,8 @@ func (e *ParagraphElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
}
|
}
|
||||||
bs.Push(be)
|
bs.Push(be)
|
||||||
|
|
||||||
renderText(w, bs.Parent().Style.StylePrimitive, rules.Prefix)
|
renderText(w, bs.Parent().Style.StylePrimitive, rules.BlockPrefix)
|
||||||
renderText(bs.Current().Block, bs.Current().Style.StylePrimitive, rules.StyledPrefix)
|
renderText(bs.Current().Block, bs.Current().Style.StylePrimitive, rules.Prefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
|
|||||||
_, _ = mw.Write([]byte("\n"))
|
_, _ = mw.Write([]byte("\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
renderText(w, bs.Current().Style.StylePrimitive, rules.StyledSuffix)
|
renderText(w, bs.Current().Style.StylePrimitive, rules.Suffix)
|
||||||
renderText(w, bs.Parent().Style.StylePrimitive, rules.Suffix)
|
renderText(w, bs.Parent().Style.StylePrimitive, rules.BlockSuffix)
|
||||||
|
|
||||||
bs.Current().Block.Reset()
|
bs.Current().Block.Reset()
|
||||||
bs.Pop()
|
bs.Pop()
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -12,10 +12,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type StylePrimitive struct {
|
type StylePrimitive struct {
|
||||||
|
BlockPrefix string `json:"block_prefix"`
|
||||||
|
BlockSuffix string `json:"block_suffix"`
|
||||||
Prefix string `json:"prefix"`
|
Prefix string `json:"prefix"`
|
||||||
Suffix string `json:"suffix"`
|
Suffix string `json:"suffix"`
|
||||||
StyledPrefix string `json:"styled_prefix"`
|
|
||||||
StyledSuffix string `json:"styled_suffix"`
|
|
||||||
Color *string `json:"color"`
|
Color *string `json:"color"`
|
||||||
BackgroundColor *string `json:"background_color"`
|
BackgroundColor *string `json:"background_color"`
|
||||||
Underline *bool `json:"underline"`
|
Underline *bool `json:"underline"`
|
||||||
@@ -143,6 +143,8 @@ func cascadeStyle(parent StyleBlock, child StyleBlock, onlyColors bool) StyleBlo
|
|||||||
s.Overlined = parent.Overlined
|
s.Overlined = parent.Overlined
|
||||||
s.Inverse = parent.Inverse
|
s.Inverse = parent.Inverse
|
||||||
s.Blink = parent.Blink
|
s.Blink = parent.Blink
|
||||||
|
s.BlockPrefix = parent.BlockPrefix
|
||||||
|
s.BlockSuffix = parent.BlockSuffix
|
||||||
s.Prefix = parent.Prefix
|
s.Prefix = parent.Prefix
|
||||||
s.Suffix = parent.Suffix
|
s.Suffix = parent.Suffix
|
||||||
s.Format = parent.Format
|
s.Format = parent.Format
|
||||||
@@ -187,6 +189,12 @@ func cascadeStyle(parent StyleBlock, child StyleBlock, onlyColors bool) StyleBlo
|
|||||||
if child.Blink != nil {
|
if child.Blink != nil {
|
||||||
s.Blink = child.Blink
|
s.Blink = child.Blink
|
||||||
}
|
}
|
||||||
|
if child.BlockPrefix != "" {
|
||||||
|
s.BlockPrefix = child.BlockPrefix
|
||||||
|
}
|
||||||
|
if child.BlockSuffix != "" {
|
||||||
|
s.BlockSuffix = child.BlockSuffix
|
||||||
|
}
|
||||||
if child.Prefix != "" {
|
if child.Prefix != "" {
|
||||||
s.Prefix = child.Prefix
|
s.Prefix = child.Prefix
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-25
@@ -5,16 +5,16 @@
|
|||||||
Block elements contain other elements and are rendered around them. All block
|
Block elements contain other elements and are rendered around them. All block
|
||||||
elements support the following style settings:
|
elements support the following style settings:
|
||||||
|
|
||||||
| Attribute | Value | Description |
|
| Attribute | Value | Description |
|
||||||
| ---------------- | ------ | -------------------------------------------------- |
|
| ---------------- | ------ | ------------------------------------------------------------ |
|
||||||
| prefix | string | Printed before the block's first element |
|
| block_prefix | string | Printed before the block's first element (in parent's style) |
|
||||||
| suffix | string | Printed after the block's last element |
|
| block_suffix | string | Printed after the block's last element (in parent's style) |
|
||||||
| styled_prefix | string | Printed before the block's first element |
|
| prefix | string | Printed before the block's first element |
|
||||||
| styled_suffix | string | Printed after the block's last element |
|
| suffix | string | Printed after the block's last element |
|
||||||
| indent | number | Specifies the indentation of the block |
|
| indent | number | Specifies the indentation of the block |
|
||||||
| margin | number | Specifies the margin around the block |
|
| margin | number | Specifies the margin around the block |
|
||||||
| color | color | Defines the default text color for the block |
|
| color | color | Defines the default text color for the block |
|
||||||
| background_color | color | Defines the default background color for the block |
|
| background_color | color | Defines the default background color for the block |
|
||||||
|
|
||||||
Elements inside a block inherit the block's following style settings:
|
Elements inside a block inherit the block's following style settings:
|
||||||
|
|
||||||
@@ -44,8 +44,8 @@ Style:
|
|||||||
"document": {
|
"document": {
|
||||||
"indent": 2,
|
"indent": 2,
|
||||||
"background_color": "234",
|
"background_color": "234",
|
||||||
"prefix": "\n",
|
"block_prefix": "\n",
|
||||||
"suffix": "\n"
|
"block_suffix": "\n"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -99,18 +99,18 @@ Style:
|
|||||||
"background_color": "57"
|
"background_color": "57"
|
||||||
},
|
},
|
||||||
"h1": {
|
"h1": {
|
||||||
"styled_prefix": "=> ",
|
"prefix": "=> ",
|
||||||
"styled_suffix": " <=",
|
"suffix": " <=",
|
||||||
"margin": 2,
|
"margin": 2,
|
||||||
"bold": true,
|
"bold": true,
|
||||||
"background_color": "69"
|
"background_color": "69"
|
||||||
},
|
},
|
||||||
"h2": {
|
"h2": {
|
||||||
"styled_prefix": "## ",
|
"prefix": "## ",
|
||||||
"margin": 4
|
"margin": 4
|
||||||
},
|
},
|
||||||
"h3": {
|
"h3": {
|
||||||
"styled_prefix": "### ",
|
"prefix": "### ",
|
||||||
"margin": 6
|
"margin": 6
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -223,10 +223,10 @@ All inline elements support the following style settings:
|
|||||||
|
|
||||||
| Attribute | Value | Description |
|
| Attribute | Value | Description |
|
||||||
| ---------------- | ------ | ----------------------------------------------------- |
|
| ---------------- | ------ | ----------------------------------------------------- |
|
||||||
|
| block_prefix | string | Printed before the element (in parent's style) |
|
||||||
|
| block_suffix | string | Printed after the element (in parent's style) |
|
||||||
| prefix | string | Printed before the element |
|
| prefix | string | Printed before the element |
|
||||||
| suffix | string | Printed after the element |
|
| suffix | string | Printed after the element |
|
||||||
| styled_prefix | string | Printed before the element |
|
|
||||||
| styled_suffix | string | Printed after the element |
|
|
||||||
| color | color | Defines the default text color for the document |
|
| color | color | Defines the default text color for the document |
|
||||||
| background_color | color | Defines the default background color for the document |
|
| background_color | color | Defines the default background color for the document |
|
||||||
| bold | bool | Increases text intensity |
|
| bold | bool | Increases text intensity |
|
||||||
@@ -275,7 +275,7 @@ Style:
|
|||||||
|
|
||||||
```
|
```
|
||||||
"item": {
|
"item": {
|
||||||
"prefix": "• "
|
"block_prefix": "• "
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ Style:
|
|||||||
|
|
||||||
```
|
```
|
||||||
"enumeration": {
|
"enumeration": {
|
||||||
"prefix": ". "
|
"block_prefix": ". "
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -363,8 +363,8 @@ Style:
|
|||||||
"link": {
|
"link": {
|
||||||
"color": "123",
|
"color": "123",
|
||||||
"underline": true,
|
"underline": true,
|
||||||
"prefix": "(",
|
"block_prefix": "(",
|
||||||
"suffix": ")"
|
"block_suffix": ")"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -408,8 +408,8 @@ Style:
|
|||||||
```
|
```
|
||||||
"image": {
|
"image": {
|
||||||
"color": "123",
|
"color": "123",
|
||||||
"prefix": "[Image: ",
|
"block_prefix": "[Image: ",
|
||||||
"suffix": "]"
|
"block_suffix": "]"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ Style:
|
|||||||
|
|
||||||
```
|
```
|
||||||
"hr": {
|
"hr": {
|
||||||
"prefix": "---"
|
"block_prefix": "---"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+18
-18
@@ -1,38 +1,38 @@
|
|||||||
{
|
{
|
||||||
"document": {
|
"document": {
|
||||||
"indent": 4,
|
"indent": 4,
|
||||||
"prefix": "\n\n",
|
"block_prefix": "\n\n",
|
||||||
"suffix": "\n\n",
|
"block_suffix": "\n\n",
|
||||||
"color": "252"
|
"color": "252"
|
||||||
},
|
},
|
||||||
"heading": {
|
"heading": {
|
||||||
"suffix": "\n",
|
"block_suffix": "\n",
|
||||||
"color": "39",
|
"color": "39",
|
||||||
"bold": true
|
"bold": true
|
||||||
},
|
},
|
||||||
"h1": {
|
"h1": {
|
||||||
"suffix": "\n\n",
|
"block_suffix": "\n\n",
|
||||||
"styled_prefix": " ",
|
"prefix": " ",
|
||||||
"styled_suffix": " ",
|
"suffix": " ",
|
||||||
"background_color": "63",
|
"background_color": "63",
|
||||||
"color": "228",
|
"color": "228",
|
||||||
"bold": true
|
"bold": true
|
||||||
},
|
},
|
||||||
"h2": {
|
"h2": {
|
||||||
"prefix": "\n",
|
"block_prefix": "\n",
|
||||||
"styled_prefix": "## "
|
"prefix": "## "
|
||||||
},
|
},
|
||||||
"h3": {
|
"h3": {
|
||||||
"styled_prefix": "### "
|
"prefix": "### "
|
||||||
},
|
},
|
||||||
"h4": {
|
"h4": {
|
||||||
"styled_prefix": "#### "
|
"prefix": "#### "
|
||||||
},
|
},
|
||||||
"h5": {
|
"h5": {
|
||||||
"styled_prefix": "##### "
|
"prefix": "##### "
|
||||||
},
|
},
|
||||||
"h6": {
|
"h6": {
|
||||||
"styled_prefix": "###### ",
|
"prefix": "###### ",
|
||||||
"color": "35",
|
"color": "35",
|
||||||
"bold": false
|
"bold": false
|
||||||
},
|
},
|
||||||
@@ -41,10 +41,10 @@
|
|||||||
"level_indent": 4
|
"level_indent": 4
|
||||||
},
|
},
|
||||||
"item": {
|
"item": {
|
||||||
"prefix": "• "
|
"block_prefix": "• "
|
||||||
},
|
},
|
||||||
"enumeration": {
|
"enumeration": {
|
||||||
"prefix": ". "
|
"block_prefix": ". "
|
||||||
},
|
},
|
||||||
"link_text": {
|
"link_text": {
|
||||||
"color": "35",
|
"color": "35",
|
||||||
@@ -63,8 +63,8 @@
|
|||||||
"color": "212"
|
"color": "212"
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
"styled_prefix": " ",
|
"prefix": " ",
|
||||||
"styled_suffix": " ",
|
"suffix": " ",
|
||||||
"background_color": "236",
|
"background_color": "236",
|
||||||
"color": "203"
|
"color": "203"
|
||||||
},
|
},
|
||||||
@@ -91,12 +91,12 @@
|
|||||||
"color": "240"
|
"color": "240"
|
||||||
},
|
},
|
||||||
"block_quote": {
|
"block_quote": {
|
||||||
"prefix": "> "
|
"block_prefix": "> "
|
||||||
},
|
},
|
||||||
"definition_list": {},
|
"definition_list": {},
|
||||||
"definition_term": {},
|
"definition_term": {},
|
||||||
"definition_description": {
|
"definition_description": {
|
||||||
"prefix": "\n🠶 "
|
"block_prefix": "\n🠶 "
|
||||||
},
|
},
|
||||||
"html_block": {},
|
"html_block": {},
|
||||||
"html_span": {}
|
"html_span": {}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"document": {
|
"document": {
|
||||||
"indent": 2,
|
"indent": 2,
|
||||||
"background_color": "234",
|
"background_color": "234",
|
||||||
"prefix": "\n",
|
"block_prefix": "\n",
|
||||||
"suffix": "\n"
|
"block_suffix": "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
"background_color": "52"
|
"background_color": "52"
|
||||||
},
|
},
|
||||||
"enumeration": {
|
"enumeration": {
|
||||||
"prefix": ". "
|
"block_prefix": ". "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,18 +4,18 @@
|
|||||||
"background_color": "57"
|
"background_color": "57"
|
||||||
},
|
},
|
||||||
"h1": {
|
"h1": {
|
||||||
"styled_prefix": "=> ",
|
"prefix": "=> ",
|
||||||
"styled_suffix": " <=",
|
"suffix": " <=",
|
||||||
"margin": 2,
|
"margin": 2,
|
||||||
"bold": true,
|
"bold": true,
|
||||||
"background_color": "69"
|
"background_color": "69"
|
||||||
},
|
},
|
||||||
"h2": {
|
"h2": {
|
||||||
"styled_prefix": "## ",
|
"prefix": "## ",
|
||||||
"margin": 4
|
"margin": 4
|
||||||
},
|
},
|
||||||
"h3": {
|
"h3": {
|
||||||
"styled_prefix": "### ",
|
"prefix": "### ",
|
||||||
"margin": 6
|
"margin": 6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"image": {
|
"image": {
|
||||||
"color": "123",
|
"color": "123",
|
||||||
"prefix": "[Image: ",
|
"block_prefix": "[Image: ",
|
||||||
"suffix": "]"
|
"block_suffix": "]"
|
||||||
},
|
},
|
||||||
"image_text": {
|
"image_text": {
|
||||||
"color": "8"
|
"color": "8"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"link": {
|
"link": {
|
||||||
"color": "123",
|
"color": "123",
|
||||||
"underline": true,
|
"underline": true,
|
||||||
"prefix": "(",
|
"block_prefix": "(",
|
||||||
"suffix": ")"
|
"block_suffix": ")"
|
||||||
},
|
},
|
||||||
"link_text": {
|
"link_text": {
|
||||||
"color": "123",
|
"color": "123",
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
"level_indent": 4
|
"level_indent": 4
|
||||||
},
|
},
|
||||||
"item": {
|
"item": {
|
||||||
"prefix": "• "
|
"block_prefix": "• "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-18
@@ -1,38 +1,38 @@
|
|||||||
{
|
{
|
||||||
"document": {
|
"document": {
|
||||||
"indent": 4,
|
"indent": 4,
|
||||||
"prefix": "\n\n",
|
"block_prefix": "\n\n",
|
||||||
"suffix": "\n\n",
|
"block_suffix": "\n\n",
|
||||||
"color": "234"
|
"color": "234"
|
||||||
},
|
},
|
||||||
"heading": {
|
"heading": {
|
||||||
"suffix": "\n",
|
"block_suffix": "\n",
|
||||||
"color": "27",
|
"color": "27",
|
||||||
"bold": true
|
"bold": true
|
||||||
},
|
},
|
||||||
"h1": {
|
"h1": {
|
||||||
"suffix": "\n\n",
|
"block_suffix": "\n\n",
|
||||||
"styled_prefix": " ",
|
"prefix": " ",
|
||||||
"styled_suffix": " ",
|
"suffix": " ",
|
||||||
"background_color": "63",
|
"background_color": "63",
|
||||||
"color": "228",
|
"color": "228",
|
||||||
"bold": true
|
"bold": true
|
||||||
},
|
},
|
||||||
"h2": {
|
"h2": {
|
||||||
"prefix": "\n",
|
"block_prefix": "\n",
|
||||||
"styled_prefix": "## "
|
"prefix": "## "
|
||||||
},
|
},
|
||||||
"h3": {
|
"h3": {
|
||||||
"styled_prefix": "### "
|
"prefix": "### "
|
||||||
},
|
},
|
||||||
"h4": {
|
"h4": {
|
||||||
"styled_prefix": "#### "
|
"prefix": "#### "
|
||||||
},
|
},
|
||||||
"h5": {
|
"h5": {
|
||||||
"styled_prefix": "##### "
|
"prefix": "##### "
|
||||||
},
|
},
|
||||||
"h6": {
|
"h6": {
|
||||||
"styled_prefix": "###### ",
|
"prefix": "###### ",
|
||||||
"bold": false
|
"bold": false
|
||||||
},
|
},
|
||||||
"text": {},
|
"text": {},
|
||||||
@@ -40,10 +40,10 @@
|
|||||||
"level_indent": 4
|
"level_indent": 4
|
||||||
},
|
},
|
||||||
"item": {
|
"item": {
|
||||||
"prefix": "• "
|
"block_prefix": "• "
|
||||||
},
|
},
|
||||||
"enumeration": {
|
"enumeration": {
|
||||||
"prefix": ". "
|
"block_prefix": ". "
|
||||||
},
|
},
|
||||||
"link_text": {
|
"link_text": {
|
||||||
"color": "29",
|
"color": "29",
|
||||||
@@ -62,8 +62,8 @@
|
|||||||
"color": "205"
|
"color": "205"
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
"styled_prefix": " ",
|
"prefix": " ",
|
||||||
"styled_suffix": " ",
|
"suffix": " ",
|
||||||
"background_color": "254",
|
"background_color": "254",
|
||||||
"color": "203"
|
"color": "203"
|
||||||
},
|
},
|
||||||
@@ -86,12 +86,12 @@
|
|||||||
"color": "240"
|
"color": "240"
|
||||||
},
|
},
|
||||||
"block_quote": {
|
"block_quote": {
|
||||||
"prefix": "> "
|
"block_prefix": "> "
|
||||||
},
|
},
|
||||||
"definition_list": {},
|
"definition_list": {},
|
||||||
"definition_term": {},
|
"definition_term": {},
|
||||||
"definition_description": {
|
"definition_description": {
|
||||||
"prefix": "\n🠶 "
|
"block_prefix": "\n🠶 "
|
||||||
},
|
},
|
||||||
"html_block": {},
|
"html_block": {},
|
||||||
"html_span": {}
|
"html_span": {}
|
||||||
|
|||||||
+23
-23
@@ -1,41 +1,41 @@
|
|||||||
{
|
{
|
||||||
"document": {
|
"document": {
|
||||||
"indent": 4,
|
"indent": 4,
|
||||||
"prefix": "\n\n",
|
"block_prefix": "\n\n",
|
||||||
"suffix": "\n\n"
|
"block_suffix": "\n\n"
|
||||||
},
|
},
|
||||||
"heading": {
|
"heading": {
|
||||||
"suffix": "\n"
|
"block_suffix": "\n"
|
||||||
},
|
},
|
||||||
"h1": {
|
"h1": {
|
||||||
"suffix": "\n\n",
|
"block_suffix": "\n\n",
|
||||||
"styled_prefix": "# "
|
"prefix": "# "
|
||||||
},
|
},
|
||||||
"h2": {
|
"h2": {
|
||||||
"prefix": "\n",
|
"block_prefix": "\n",
|
||||||
"styled_prefix": "## "
|
"prefix": "## "
|
||||||
},
|
},
|
||||||
"h3": {
|
"h3": {
|
||||||
"styled_prefix": "### "
|
"prefix": "### "
|
||||||
},
|
},
|
||||||
"h4": {
|
"h4": {
|
||||||
"styled_prefix": "#### "
|
"prefix": "#### "
|
||||||
},
|
},
|
||||||
"h5": {
|
"h5": {
|
||||||
"styled_prefix": "##### "
|
"prefix": "##### "
|
||||||
},
|
},
|
||||||
"h6": {
|
"h6": {
|
||||||
"styled_prefix": "###### "
|
"prefix": "###### "
|
||||||
},
|
},
|
||||||
"text": {},
|
"text": {},
|
||||||
"list": {
|
"list": {
|
||||||
"level_indent": 4
|
"level_indent": 4
|
||||||
},
|
},
|
||||||
"item": {
|
"item": {
|
||||||
"prefix": "• "
|
"block_prefix": "• "
|
||||||
},
|
},
|
||||||
"enumeration": {
|
"enumeration": {
|
||||||
"prefix": ". "
|
"block_prefix": ". "
|
||||||
},
|
},
|
||||||
"link_text": {},
|
"link_text": {},
|
||||||
"link": {},
|
"link": {},
|
||||||
@@ -44,35 +44,35 @@
|
|||||||
},
|
},
|
||||||
"image": {},
|
"image": {},
|
||||||
"code": {
|
"code": {
|
||||||
"prefix": "`",
|
"block_prefix": "`",
|
||||||
"suffix": "`"
|
"block_suffix": "`"
|
||||||
},
|
},
|
||||||
"code_block": {
|
"code_block": {
|
||||||
"margin": 4
|
"margin": 4
|
||||||
},
|
},
|
||||||
"table": {},
|
"table": {},
|
||||||
"strikethrough": {
|
"strikethrough": {
|
||||||
"prefix": "~~",
|
"block_prefix": "~~",
|
||||||
"suffix": "~~"
|
"block_suffix": "~~"
|
||||||
},
|
},
|
||||||
"emph": {
|
"emph": {
|
||||||
"prefix": "*",
|
"block_prefix": "*",
|
||||||
"suffix": "*"
|
"block_suffix": "*"
|
||||||
},
|
},
|
||||||
"strong": {
|
"strong": {
|
||||||
"prefix": "**",
|
"block_prefix": "**",
|
||||||
"suffix": "**"
|
"block_suffix": "**"
|
||||||
},
|
},
|
||||||
"hr": {
|
"hr": {
|
||||||
"format": "\n--------\n"
|
"format": "\n--------\n"
|
||||||
},
|
},
|
||||||
"block_quote": {
|
"block_quote": {
|
||||||
"prefix": "> "
|
"block_prefix": "> "
|
||||||
},
|
},
|
||||||
"definition_list": {},
|
"definition_list": {},
|
||||||
"definition_term": {},
|
"definition_term": {},
|
||||||
"definition_description": {
|
"definition_description": {
|
||||||
"prefix": "\n🠶 "
|
"block_prefix": "\n🠶 "
|
||||||
},
|
},
|
||||||
"html_block": {},
|
"html_block": {},
|
||||||
"html_span": {}
|
"html_span": {}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ func (e *TableElement) Render(w io.Writer, ctx RenderContext) error {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
renderText(ctx.table.indentWriter, bs.Current().Style.StylePrimitive, rules.Prefix)
|
renderText(ctx.table.indentWriter, bs.Current().Style.StylePrimitive, rules.BlockPrefix)
|
||||||
ctx.table.writer = tablewriter.NewWriter(ctx.table.indentWriter)
|
ctx.table.writer = tablewriter.NewWriter(ctx.table.indentWriter)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ func (e *TableElement) Finish(w io.Writer, ctx RenderContext) error {
|
|||||||
ctx.table.writer = nil
|
ctx.table.writer = nil
|
||||||
|
|
||||||
rules := ctx.styles.Table
|
rules := ctx.styles.Table
|
||||||
renderText(ctx.table.indentWriter, ctx.blockStack.Current().Style.StylePrimitive, rules.Suffix)
|
renderText(ctx.table.indentWriter, ctx.blockStack.Current().Style.StylePrimitive, rules.BlockSuffix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user