-
Notifications
You must be signed in to change notification settings - Fork 62
Typst
Tip
You can find type definitions in definitions/renderers/typst.lua.
Options that affect how typst is shown in previews are part of this. You can find the default values here.
---@type markview.config.typst
typst = {
enable = true,
code_blocks = {
enable = true,
style = "block",
text_direction = "right",
min_width = 60,
pad_amount = 3,
pad_char = " ",
text = " Code",
hl = "MarkviewCode",
text_hl = "MarkviewIcon5"
},
code_spans = {
enable = true,
padding_left = " ",
padding_right = " ",
hl = "MarkviewCode"
},
escapes = {
enable = true
},
headings = {
enable = true,
shift_width = 1,
heading_1 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading1Sign",
icon = " ", hl = "MarkviewHeading1",
},
heading_2 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading2Sign",
icon = " ", hl = "MarkviewHeading2",
},
heading_3 = {
style = "icon",
icon = " ", hl = "MarkviewHeading3",
},
heading_4 = {
style = "icon",
icon = " ", hl = "MarkviewHeading4",
},
heading_5 = {
style = "icon",
icon = " ", hl = "MarkviewHeading5",
},
heading_6 = {
style = "icon",
icon = " ", hl = "MarkviewHeading6",
}
},
labels = {
enable = true,
default = {
hl = "MarkviewInlineCode",
padding_left = " ",
icon = " ",
padding_right = " "
}
},
list_items = {
enable = true,
indent_size = function (buffer)
if type(buffer) ~= "number" then
return vim.bo.shiftwidth or 4;
end
--- Use 'shiftwidth' value.
return vim.bo[buffer].shiftwidth or 4;
end,
shift_width = 4,
marker_minus = {
add_padding = true,
text = "●",
hl = "MarkviewListItemMinus"
},
marker_plus = {
add_padding = true,
text = "%d)",
hl = "MarkviewListItemPlus"
},
marker_dot = {
add_padding = true,
}
},
math_blocks = {
enable = true,
text = " Math ",
pad_amount = 3,
pad_char = " ",
hl = "MarkviewCode",
text_hl = "MarkviewCodeInfo"
},
math_spans = {
enable = true,
padding_left = " ",
padding_right = " ",
hl = "MarkviewInlineCode"
},
raw_blocks = {
enable = true,
style = "block",
label_direction = "right",
sign = true,
min_width = 60,
pad_amount = 3,
pad_char = " ",
border_hl = "MarkviewCode",
default = {
block_hl = "MarkviewCode",
pad_hl = "MarkviewCode"
},
["diff"] = {
block_hl = function (_, line)
if line:match("^%+") then
return "MarkviewPalette4";
elseif line:match("^%-") then
return "MarkviewPalette1";
else
return "MarkviewCode";
end
end,
pad_hl = "MarkviewCode"
}
},
raw_spans = {
enable = true,
padding_left = " ",
padding_right = " ",
hl = "MarkviewInlineCode"
},
reference_links = {
enable = true,
default = {
icon = " ",
hl = "MarkviewHyperlink"
},
},
subscripts = {
enable = true,
hl = "MarkviewSubscript"
},
superscripts = {
enable = true,
hl = "MarkviewSuperscript"
},
symbols = {
enable = true,
hl = "Special"
},
terms = {
enable = true,
default = {
text = " ",
hl = "MarkviewPalette6Fg"
},
},
url_links = {
enable = true,
default = {
icon = " ",
hl = "MarkviewEmail"
},
["github%.com/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/tree/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/tree/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/commits/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/commits/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/releases$"] = {
--- github.com/<user>/<repo>/releases
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/tags$"] = {
--- github.com/<user>/<repo>/tags
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/issues$"] = {
--- github.com/<user>/<repo>/issues
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/pulls$"] = {
--- github.com/<user>/<repo>/pulls
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/wiki$"] = {
--- github.com/<user>/<repo>/wiki
icon = " ",
hl = "MarkviewPalette0Fg"
},
["developer%.mozilla%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["w3schools%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette4Fg"
},
["stackoverflow%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["reddit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["github%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["gitlab%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["dev%.to"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["codepen%.io"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["replit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["jsfiddle%.net"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["npmjs%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["pypi%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["mvnrepository%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette1Fg"
},
["medium%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["linkedin%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["news%.ycombinator%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
}
},
- type:
boolean
default:true
Allows viewing typst in preview.
Changes how code blocks look.
---@type markview.config.typst.code_blocks
code_blocks = {
enable = true,
hl = "MarkviewCode",
min_width = 60,
pad_amount = 3,
pad_char = " ",
style = "block",
text = " Code",
text_direction = "right",
text_hl = "MarkviewIcon5"
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"MarkviewCode"
Highlight group used for the background.
- type:
integer
default:60
Minimum width of code blocks.
- type:
integer
default:2
Width of the left & right border/padding.
- type:
string
default:" "
Character used for the borders/paddings.
Text to show in the signcolumn.
- type:
string
Highlight group used for the sign.
- type:
"simple" | "block"
default:"block"
Changes how code blocks are shown. Supported values are,
-
"simple"
Entire line is highlighted. Useful whenwrap
is enabled. -
"block"
A block is created around the code block and paddings are added before & after each line.
- type:
string
default:" Code"
Text to show on the top-left/top-right side of the code block.
- type:
"left" | "right"
default:"right"
Changes which side text should be shown on.
- type:
string
Highlight group used for text.
Changes how code spans look. See how inline elements are configured.
- type:
{ enable: boolean }
default:{ enable = true }
Allows showing the escaped characters in previews.
- type:
boolean
default:true
Self-explanatory.
Changes how different headings look like.
---@type markview.config.typst.headings
headings = {
enable = true,
shift_width = 1,
heading_1 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading1Sign",
icon = " ", hl = "MarkviewHeading1",
},
heading_2 = {
style = "icon",
sign = " ", sign_hl = "MarkviewHeading2Sign",
icon = " ", hl = "MarkviewHeading2",
},
heading_3 = {
style = "icon",
icon = " ", hl = "MarkviewHeading3",
},
heading_4 = {
style = "icon",
icon = " ", hl = "MarkviewHeading4",
},
heading_5 = {
style = "icon",
icon = " ", hl = "MarkviewHeading5",
},
heading_6 = {
style = "icon",
icon = " ", hl = "MarkviewHeading6",
}
},
- type:
boolean
default:true
Self-explanatory.
- type:
integer
default:1
Number of spaces to add before the heading per level.
Configuration for level n
headings.
- type:
string
Highlight group for the heading.
Note
This has no effect if style is set to simple
.
- type:
string
Text to add as icon before the heading text.
Note
This has no effect if style is set to simple
.
- type:
string
Highlight group for icon.
Note
This has no effect if style is set to simple
.
- type:
string
Text to show in the signcolumn.
Note
This has no effect if style is set to simple
.
- type:
string
Highlight group for sign.
- type:
"simple" | "icon"
Heading preview style. Possible values are,
-
"simple"
, Only Highlight the line. -
"icon"
, Icons & signs with highlight.
Changes how labels are shown.
---@type markview.config.typst.labels
labels = {
enable = true,
default = {
hl = "MarkviewInlineCode",
padding_left = " ",
icon = " ",
padding_right = " "
}
},
- type:
boolean
default:true
Self-explanatory.
Default configuration for labels. See how inline elements are configured.
- type: markview.config.__inline
Configuration for labels whose text matches string
. See how inline elements are configured.
Note
The structure for labels is <<text>>
.
Changes how list items are shown.
---@type markview.config.markdown.list_items
list_items = {
enable = true,
indent_size = function (buffer)
if type(buffer) ~= "number" then
return vim.bo.shiftwidth or 4;
end
--- Use 'shiftwidth' value.
return vim.bo[buffer].shiftwidth or 4;
end,
shift_width = 4,
marker_minus = {
add_padding = true,
text = "●",
hl = "MarkviewListItemMinus"
},
marker_plus = {
add_padding = true,
text = "%d)",
hl = "MarkviewListItemPlus"
},
marker_dot = {
add_padding = true,
}
},
- type:
boolean
default:true
Self-explanatory.
- type:
integer | fun(bufnr: integer): integer
Indentation size in list items.
Important
Using tabs for indentation can cause incorrect indent to show up!
- type:
integer | fun(bufnr: integer): integer
default:4
Number of spaces to add per indent level of a list item.
Configuration for N.
list items.
---@type markview.config.markdown.list_items.typst
marker_dot = {
enable = true,
add_padding = true,
text = "%d.",
hl = "MarkviewListItemStar"
}
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:true
Enables indentation in preview for this type of list items.
- type:
string
default:"%d."
Format string used for the preview of list item(should have %d
in it).
- type:
string
default:"MarkviewListItemMinus"
Highlight group for text.
Configuration for -
list items.
---@type markview.config.markdown.list_items.typst
marker_minus = {
enable = true,
add_padding = true,
text = "●",
hl = "MarkviewListItemMinus"
}
- type:
boolean
default:true
Self-explanatory.
- type:
boolean
default:true
Enables indentation in preview for this type of list items.
- type:
string
default:"●"
Text used as the marker in preview.
- type:
string
default:"MarkviewListItemMinus"
Highlight group for text.
Configuration for +
list items. Same as marker_minus.
Changes how math block are shown.
---@type markview.config.typst.math_blocks
math_blocks = {
enable = true,
text = " Math ",
pad_amount = 3,
pad_char = " ",
hl = "MarkviewCode",
text_hl = "MarkviewCodeInfo"
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"MarkviewCode"
Highlight group used for the background.
- type:
integer
default:2
Width of the left & right border/padding.
- type:
string
default:" "
Character used for the borders/paddings.
Text to show in the signcolumn.
- type:
string
Highlight group used for the text.
Changes how inline maths are shown. See how inline elements are configured.
See also,
- icon_provider, for disabling icons.
Changes how raw blocks look.
---@type markview.config.typst.raw_blocks
raw_blocks = {
enable = true,
style = "block",
label_direction = "right",
sign = true,
min_width = 60,
pad_amount = 3,
pad_char = " ",
border_hl = "MarkviewCode",
default = {
block_hl = "MarkviewCode",
pad_hl = "MarkviewCode"
},
["diff"] = {
block_hl = function (_, line)
if line:match("^%+") then
return "MarkviewPalette4";
elseif line:match("^%-") then
return "MarkviewPalette1";
else
return "MarkviewCode";
end
end,
pad_hl = "MarkviewCode"
}
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"MarkviewCode"
Highlight group used for the top & bottom part of the code block.
- type:
string
default:"MarkviewCodeInfo"
Highlight group used for the info string.
- type:
"left" | "right"
default:"right"
Which side the language name & icon should be shown on.
- type:
string
Highlight group used for the language name & icon.
Tip
This can be used to overwrite the highlight group set by the icon_provider!
- type:
integer
default:60
Minimum width of code blocks.
- type:
integer
default:2
Width of the left & right border/padding.
- type:
string
default:" "
Character used for the borders/paddings.
Default configuration for highlighting a line of the code block.
---@type markview.config.typst.code_blocks.opts
default = {
block_hl = "MarkviewCode",
pad_hl = "MarkviewCode"
},
- type:
string
default:"MarkviewCode"
Highlight group for the text of a line.
- type:
string
default:"MarkviewCode"
Highlight group for the padding around the line.
Configuration for code blocks whose language is string
.
---@type markview.config.typst.code_blocks.opts
["string"] = {
block_hl = nil,
pad_hl = nil
},
Tip
You can use this for making stuff like diff
prettier!
- type:
string | fun(bufnr: integer, line: string): string
Highlight group for the text of a line.
- type:
string | fun(bufnr: integer, line: string): string
Highlight group for the padding around the line.
- type:
"simple" | "block"
default:"block"
Changes how code blocks are shown. Supported values are,
-
"simple"
Entire line is highlighted. Useful whenwrap
is enabled. -
"block"
A block is created around the code block and paddings are added before & after each line.
- type:
boolean
default:true
Enables language icon in the signcolumn.
Changes how reference links are shown.
---@type markview.config.types.link_ref
reference_links = {
enable = true,
default = {
icon = " ",
hl = "MarkviewHyperlink"
},
},
- type:
boolean
default:true
Self-explanatory.
Default configuration. See how inline elements are configured.
- type: markview.config.__inline
Configuration for reference links whose destination matches string
. See how inline elements are configured.
Note
The structure for reference links is @<destination>
.
Configuration for subscript texts.
---@type markview.config.typst.subscripts
subscripts = {
enable = true,
hl = "MarkviewSubscript",
marker_left = nil,
marker_right = nil,
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"MarkviewSubscript"
Highlight group.
- type:
string
Marker to show before subscript text.
Note
This only shows up if the text can't be shown as subscripted text.
- type:
string
Marker to show after subscript text.
Note
This only shows up if the text can't be shown as subscripted text.
Configuration for superscript texts. Same as subscripts.
---@type markview.config.typst.superscripts
superscripts = {
enable = true,
hl = "MarkviewSuperscript",
marker_left = nil,
marker_right = nil,
},
Configuration for symbols.
---@type markview.config.typst.symbols
superscripts = {
enable = true,
hl = "Special",
marker_left = nil,
marker_right = nil,
},
- type:
boolean
default:true
Self-explanatory.
- type:
string
default:"Special"
Highlight group.
Changes how reference links are shown.
---@type markview.config.types.link_ref
terms = {
enable = true,
default = {
text = " ",
hl = "MarkviewPalette6Fg"
},
},
- type:
boolean
default:true
Self-explanatory.
Default configuration. See how inline elements are configured.
- type: markview.config.__inline
Configuration for terms whose label matches string
. See how inline elements are configured.
Note
The structure for terms is / <label>: @<destination>
.
Changes how uri autolinks are shown.
---@type markview.config.typst.url_links
url_links = {
enable = true,
default = {
icon = " ",
hl = "MarkviewHyperlink",
},
["github%.com/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/tree/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/tree/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+/commits/[%a%d%-%_%.]+%/?$"] = {
--- github.com/<user>/<repo>/commits/<branch>
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/releases$"] = {
--- github.com/<user>/<repo>/releases
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/tags$"] = {
--- github.com/<user>/<repo>/tags
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/issues$"] = {
--- github.com/<user>/<repo>/issues
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/pulls$"] = {
--- github.com/<user>/<repo>/pulls
icon = " ",
hl = "MarkviewPalette0Fg"
},
["github%.com/[%a%d%-%_%.]+/[%a%d%-%_%.]+%/wiki$"] = {
--- github.com/<user>/<repo>/wiki
icon = " ",
hl = "MarkviewPalette0Fg"
},
["developer%.mozilla%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["w3schools%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette4Fg"
},
["stackoverflow%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["reddit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["github%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["gitlab%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["dev%.to"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["codepen%.io"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["replit%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
["jsfiddle%.net"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["npmjs%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["pypi%.org"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette0Fg"
},
["mvnrepository%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette1Fg"
},
["medium%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette6Fg"
},
["linkedin%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette5Fg"
},
["news%.ycombinator%.com"] = {
priority = -9999,
icon = " ",
hl = "MarkviewPalette2Fg"
},
},
- type:
boolean
default:true
Self-explanatory.
Default configuration for URI autolinks. See how inline elements are configured.
- type: markview.config.__inline
Configuration for URL links whose text matches string
. See how inline elements are configured.