-
Notifications
You must be signed in to change notification settings - Fork 61
HTML
Tip
You can find the type definitions in definitions/renderers/html.lua.
Options that change how inline HTML is shown in preview are part of this. Default values can be found here.
---@type markview.config.html
html = {
enable = true,
container_elements = {
enable = true,
["^a$"] = {
on_opening_tag = { conceal = "", virt_text_pos = "inline", virt_text = { { "", "MarkviewHyperlink" } } },
on_node = { hl_group = "MarkviewHyperlink" },
on_closing_tag = { conceal = "" },
},
["^b$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Bold" },
on_closing_tag = { conceal = "" },
},
["^code$"] = {
on_opening_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { " ", "MarkviewInlineCode" } } },
on_node = { hl_group = "MarkviewInlineCode" },
on_closing_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { " ", "MarkviewInlineCode" } } },
},
["^em$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "@text.emphasis" },
on_closing_tag = { conceal = "" },
},
["^i$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Italic" },
on_closing_tag = { conceal = "" },
},
["^mark$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "MarkviewPalette1" },
on_closing_tag = { conceal = "" },
},
["^pre$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Special" },
on_closing_tag = { conceal = "" },
},
["^strong$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "@text.strong" },
on_closing_tag = { conceal = "" },
},
["^sub$"] = {
on_opening_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "↓[", "MarkviewSubscript" } } },
on_node = { hl_group = "MarkviewSubscript" },
on_closing_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "]", "MarkviewSubscript" } } },
},
["^sup$"] = {
on_opening_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "↑[", "MarkviewSuperscript" } } },
on_node = { hl_group = "MarkviewSuperscript" },
on_closing_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "]", "MarkviewSuperscript" } } },
},
["^u$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Underlined" },
on_closing_tag = { conceal = "" },
},
},
headings = {
enable = true,
heading_1 = {
hl_group = "MarkviewPalette1Bg"
},
heading_2 = {
hl_group = "MarkviewPalette2Bg"
},
heading_3 = {
hl_group = "MarkviewPalette3Bg"
},
heading_4 = {
hl_group = "MarkviewPalette4Bg"
},
heading_5 = {
hl_group = "MarkviewPalette5Bg"
},
heading_6 = {
hl_group = "MarkviewPalette6Bg"
},
},
void_elements = {
enable = true,
["^hr$"] = {
on_node = {
conceal = "",
virt_text_pos = "inline",
virt_text = {
{ "─", "MarkviewGradient2" },
{ "─", "MarkviewGradient3" },
{ "─", "MarkviewGradient4" },
{ "─", "MarkviewGradient5" },
{ " ◉ ", "MarkviewGradient9" },
{ "─", "MarkviewGradient5" },
{ "─", "MarkviewGradient4" },
{ "─", "MarkviewGradient3" },
{ "─", "MarkviewGradient2" },
}
}
},
["^br$"] = {
on_node = {
conceal = "",
virt_text_pos = "inline",
virt_text = {
{ "", "Comment" },
}
}
},
}
},
- type:
boolean
default:true
Enables preview of inline HTML.
Changes how container elements are shown in previews.
---@type markview.config.html.container_elements
container_elements = {
enable = true,
["^a$"] = {
on_opening_tag = { conceal = "", virt_text_pos = "inline", virt_text = { { "", "MarkviewHyperlink" } } },
on_node = { hl_group = "MarkviewHyperlink" },
on_closing_tag = { conceal = "" },
},
["^b$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Bold" },
on_closing_tag = { conceal = "" },
},
["^code$"] = {
on_opening_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { " ", "MarkviewInlineCode" } } },
on_node = { hl_group = "MarkviewInlineCode" },
on_closing_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { " ", "MarkviewInlineCode" } } },
},
["^em$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "@text.emphasis" },
on_closing_tag = { conceal = "" },
},
["^i$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Italic" },
on_closing_tag = { conceal = "" },
},
["^mark$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "MarkviewPalette1" },
on_closing_tag = { conceal = "" },
},
["^pre$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Special" },
on_closing_tag = { conceal = "" },
},
["^strong$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "@text.strong" },
on_closing_tag = { conceal = "" },
},
["^sub$"] = {
on_opening_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "↓[", "MarkviewSubscript" } } },
on_node = { hl_group = "MarkviewSubscript" },
on_closing_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "]", "MarkviewSubscript" } } },
},
["^sup$"] = {
on_opening_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "↑[", "MarkviewSuperscript" } } },
on_node = { hl_group = "MarkviewSuperscript" },
on_closing_tag = { conceal = "", hl_mode = "combine", virt_text_pos = "inline", virt_text = { { "]", "MarkviewSuperscript" } } },
},
["^u$"] = {
on_opening_tag = { conceal = "" },
on_node = { hl_group = "Underlined" },
on_closing_tag = { conceal = "" },
},
},
- type:
boolean
default:true
Self-explanatory.
Changes how <string></string>
will be shown in previews.
---@type markview.config.html.container_elements.opts
["^a$"] = {
closing_tag_offset = nil,
node_offset = nil,
opening_tag_offset = nil,
on_opening_tag = {
conceal = "",
virt_text_pos = "inline",
virt_text = { { "", "MarkviewHyperlink" } }
},
on_node = { hl_group = "MarkviewHyperlink" },
on_closing_tag = { conceal = "" },
},
- type:
fun(range: integer[]): integer[]
See also,
Modifies the range of the closing tag.
- type:
fun(range: integer[]): integer[]
See also,
Modifies the range of the entire node/element.
- type:
fun(range: integer[]): integer[]
See also,
Modifies the range of the opening tag.
- type:
table
Configuration for the extmark placed on the opening tag. The range is affected by opening_tag_offset.
- type:
table
Configuration for the extmark placed on the element. The range is affected by node_offset.
- type:
table
Configuration for the extmark placed on the closing tag. The range is affected by closing_tag_offset.
Changes how headings are shown in previews.
---@type markview.config.html.headings
headings = {
enable = true,
heading_1 = {
hl_group = "MarkviewPalette1Bg"
},
heading_2 = {
hl_group = "MarkviewPalette2Bg"
},
heading_3 = {
hl_group = "MarkviewPalette3Bg"
},
heading_4 = {
hl_group = "MarkviewPalette4Bg"
},
heading_5 = {
hl_group = "MarkviewPalette5Bg"
},
heading_6 = {
hl_group = "MarkviewPalette6Bg"
},
},
- type:
boolean
default:true
Self-explanatory.
- type:
table
Configuration for the extmark placed on the element.
- type:
table
Configuration for the extmark placed on the element.
- type:
table
Configuration for the extmark placed on the element.
- type:
table
Configuration for the extmark placed on the element.
- type:
table
Configuration for the extmark placed on the element.
- type:
table
Configuration for the extmark placed on the element.
Changes how void elements are shown in previews.
---@type markview.config.void_elements
void_elements = {
enable = true,
["^hr$"] = {
on_node = {
conceal = "",
virt_text_pos = "inline",
virt_text = {
{ "─", "MarkviewGradient2" },
{ "─", "MarkviewGradient3" },
{ "─", "MarkviewGradient4" },
{ "─", "MarkviewGradient5" },
{ " ◉ ", "MarkviewGradient9" },
{ "─", "MarkviewGradient5" },
{ "─", "MarkviewGradient4" },
{ "─", "MarkviewGradient3" },
{ "─", "MarkviewGradient2" },
}
}
},
["^br$"] = {
on_node = {
conceal = "",
virt_text_pos = "inline",
virt_text = {
{ "", "Comment" },
}
}
},
}
Changes how <string/>
will be shown in previews.
- type:
fun(range: integer[]): integer[]
See also,
Modifies the range of the tag.
- type:
table
Configuration for the extmark placed on the node/element. The range is affected by node_offset.