A hackable markdown, Typst, latex, html(inline) & Asciidoc previewer for Neovim
โ๏ธ Markview.nvim
A hackable Markdown, HTML, LaTeX, Typst & YAML previewer for Neovim.
| :set wrap | :set nowrap | |---------------|----------------| |
|
|
โจ Features
Core features,
- Preview
Markdown,HTML, $LaTeX$,Typst&Asciidoc(See integrations#Asciidoc) within Neovim. - Hybrid editing mode! Allowing editing & previewing at the same time.
- Splitview! Allows editing & previewing side-by-side.
Wrapsupport(markdown only, at the moment)! Allows using text wrapping while not losing most rendering features! See integrations#wrap for fixing visual glitches or integrations#nowrap for disabling it.- Highly customisable! You can change almost anything using the config!
- Dynamic
highlight groupsthat automatically updates with the colorscheme! Callout,checkboxcompletions forblink.cmp&nvim-cmp.- Works with
tree-sitter injectionstoo!
๐ Table of contents
Also see,๐ Complete feature-list
Expand to see complete feature list
Asciidoc

Supported syntax,
- Admonitions
- Checkboxes(also supports custom checkbox states).
- Horizontal rules
- Literal blocks
- Hiding document attributes
- Image macros
- Keycode macros
- List items(ordered & unordered)
- Automated TOC(Table of Contents)
Asciidoc inline
Supported syntax,
- Bold
- Highlights
- Italic
- Monospace
- URI
Fancy comments,

Comments are still experimental! The original parser only supports basic features.
Conventional commit style comments with support for a subset of markdown & vimdoc. See integrations#fancy-comments For more info.
Supported syntax,
- Tasks(e.g.
feat,TODOetc.) - Task scopes.
BoldItalicCode'Quoted_text'"Double quoted text"@mentionsissues/reference#52https://example.com|help-section|- Code blocks
HTML,

- Customizable previews for
container&voidelements. - Supports the following container elements out of the box,
<a></a>
+ <b></b>
+ <code></code>
+ <em></em>
+ <i></i>
+ <kbd></kbd>
+ <mark></mark>
+ <pre></pre>
+ <s></s>, <strike></strike>, <del></del>
+ <strong></strong>
+ <sub></sub>
+ <sup></sup>
+ <u></u>
- Supports the following void elements out of the box,
<hr>
+ <br>
LaTeX,

- Supports basic LaTeX syntax,
$$...$$) & inline math(typically $...$).
+ Escaped characters.
+ Math fonts
+ Math symbols.
+ \text{}.
- Supports commonly used math commands out of the box,
\frac{}
+ \sin{}
+ \cos{}
+ \tan{}
+ \sinh{}
+ \cosh{}
+ \tanh{}
+ \csc{}
+ \sec{}
+ \cot{}
+ \csch{}
+ \sech{}
+ \coth{}
+ \arcsin{}
+ \arccos{}
+ \arctan{}
+ \arg{}
+ \deg{}
+ \drt{}
+ \dim{}
+ \exp{}
+ \gcd{}
+ \hom{}
+ \inf{}
+ \ker{}
+ \lg{}
+ \lim{}
+ \liminf{}
+ \limsup{}
+ \ln{}
+ \log{}
+ \min{}
+ \max{}
+ \Pr{}
+ \sup{}
+ \sqrt{}
+ \lvert{}
+ \lVert{}
+ \boxed{}
- Supports the following math fonts(requires any modern Unicode font),
default(Default math font).
+ \mathbb{}
+ \mathbf{}
+ \mathbffrak{}
+ \mathbfit{}
+ \nathbfscr{}
+ \mathcal{}
+ \mathfrak{}
+ \mathsf{}
+ \mathsfbf{}
+ \mathsfbfit{}
+ \mathsfit{}
+ \mathtt{}
- Supports Unicode based subscript & superscript texts.
- Supports 2056 different math symbol definitions.
Markdown,

- Supports basic markdown(Github-flavored) syntax,
callouts & titles).
+ Fenced code blocks.
+ Headings(setext & atx).
+ Horizontal rules.
+ List items(+, -, *, n. & n)).
+ Minus & plus metadata.
+ Reference link definitions.
+ Tables.
+ Checkboxes(supports minimal-style checkboxes).
+ Email links.
+ Entity references.
+ Escaped characters.
+ Footnotes.
+ Hyperlinks.
+ Images.
+ Inline codes/Code spans.
+ Autolinks
Wrapsupport for,
markdown.headings.org_indent is used).
+ List items(when markdown.listitems.<item>.addpadding is true).
+ tables(limited due to technical limitations).
Org-modelike indentation for headings.
- Obsidian/PKM extended syntax support,
- Wide variety of HTML entity names & codes support.
- Github emoji shorthands support. Supports 1920 shorthands.
- Custom configuration based on link patterns.
Typst,

- Supports the following items,
-, + & n.).
+ Math blocks.
+ Math spans.
+ Raw blocks.
+ Raw spans.
+ Reference links.
+ Subscripts.
+ Superscripts.
+ Symbols.
+ Terms.
+ URL links.
- Supports a variety of typst symbols,
- Supports Unicode based subscript & superscript texts.
Org-modelike indentation for headings.
YAML,

- Custom property icons.
- Custom property scope decorations.
- Custom icons(/decorations) based on property type & value(e.g.
booleans).
- Supports the following properties out of the box,
Hybrid mode
| Normal hybrid mode | Linewise hybrid mode | |--------------------|----------------------| |
|
|
- Node-based edit range(default).
TSNode under the cursor. Useful when editing lists, block quotes, code blocks, tables etc.
- Range-based edit range.
- Supports multi-window setups.
Splitview
- View previews in a separate window.
- Scroll sync between raw file & preview window.
Others
Internal Icon provider features,
- 708 different filetype configuration.
- Dynamic highlight groups for matching the colorscheme.
- You can use
:Markview traceShowto see what the plugin has been doing(including how long some of them took). - You can also use
:Markview traceExportto export these logs.
๐ Requirements
System,
- Neovim: >= 0.10.3
It is recommended to usenowrap(though there is wrap support in the plugin) &expandtab.
Colorscheme,
- Any tree-sitter based colorscheme is recommended.
>[!NOTE]
You need to change the config to use the desired icon provider.>
> preview = { > icon_provider = "internal", -- "mini" or "devicons" > } > } > Parsers,> {
>[!TIP]
You can use nvim-treesitter to easily install parsers. You can install all the parsers with the following command, > >> :TSInstall markdown markdown_inline html latex typst yaml
>[!IMPORTANT]
On windows, you might need tree-sitter CLI for the $LaTeX$ parser.
markdownmarkdown_inlinecomment(optional)html(optional)latex(optional)typst(optional)yaml(optional)- tree-sitter-asciidoc(optional)
Fonts,
- Any modern Unicode font is required for math symbols.
- Nerd fonts are recommended.
It is recommended to run :checkhealth markview after installing the plugin to check if any potential issues exist.
๐ Installation
๐ฆ vim.pack
Add this to your init.lua.
vim.pack.add({
"https://github.com/OXY2DEV/markview.nvim",
})
๐งฉ Vim-plug
Add this to your plugin list.
Plug 'OXY2DEV/markview.nvim'
๐ค Lazy.nvim
>[!WARNING]
Do not lazy load this plugin as it is already lazy-loaded. Lazy-loading may cause more time for the previews to load when starting Neovim!
The plugin should be loaded after your colorscheme to ensure the correct highlight groups are used. See integrations.transparentcolorschemes if you use a transparent colorscheme and the colors don't look right.
-- For plugins/markview.lua users.
return {
"OXY2DEV/markview.nvim",
lazy = false,
-- Completion for blink.cmp -- dependencies = { "saghen/blink.cmp" }, };
-- For plugins.lua users.
{
"OXY2DEV/markview.nvim",
lazy = false,
-- Completion for blink.cmp -- dependencies = { "saghen/blink.cmp" }, },
๐ฆ Mini.deps
local MiniDeps = require("mini.deps");
MiniDeps.add({ source = "OXY2DEV/markview.nvim",
-- Completion for blink.cmp -- depends = { "saghen/blink.cmp" }, });
๐ Rocks.nvim
>[!WARNING]
luarocks packagemay sometimes be a bit behindmain.
:Rocks install markview.nvim
๐ฅ GitHub release
Tagged releases can be found in the release page.
>[!NOTE]
Github releasesmay sometimes be slightly behindmain.
๐ชฒ Known bugs
code spans don't get recognized when on the line after acode block(if the line after thecode spanis empty).
markdown or the markdown_inline parser.
- Incorrect wrapping when setting
wrapusingmodeline.
textoff being 0(instead of the size of the statuscolumn) when entering a buffer.
๐งญ Usage
You can find more usage recipes here.
๐ Commands
This plugin follows the sub-commands approach for creating commands. There is only a single :Markview command.
It comes with the following sub-commands,
>[!NOTE]
When no sub-command name is provided(or an invalid sub-command is used):Markviewwill run:Markview Toggle.
| Sub-command | Arguments | Description | |------------------|---------------------|------------------------------------------| | Toggle | none | Toggles preview globally. | | Enable | none | Enables preview globally. | | Disable | none | Disables preview globally. | | toggle | buffer, integer | Toggles preview for buffer. | | enable | buffer, integer | Enables preview for buffer. | | disable | buffer, integer | Disables preview for buffer. | | splitToggle | none | Toggles splitview. |
Advanced commands are given below
Sub-commands related to auto-registering new buffers for previews and/or manually attaching/detaching buffers,
| Sub-command | Arguments | Description | |------------------|---------------------|------------------------------------------| | attach | buffer, integer | Attaches to buffer. | | detach | buffer, integer | Detaches from buffer. | | Start | none | Allows attaching to new buffers. | | Stop | none | Prevents attaching to new buffers. |
Sub-commands related to controlling hybrid_mode,
| Sub-command | Arguments | Description | |------------------|---------------------|------------------------------------------| | HybridEnable | none | Enables hybrid mode. | | HybridDisable | none | Disables hybrid mode. | | HybridToggle | none | Toggles hybrid mode. | | hybridEnable | buffer, integer | Enables hybrid mode for buffer. | | hybridDisable | buffer, integer | Disables hybrid mode for buffer. | | hybridToggle | buffer, integer | Toggles hybrid mode for buffer. | | linewiseEnable | none | Enables linewise hybrid mode. | | linewiseDisable| none | Disables linewise hybrid mode. | | linewiseToggle | none | Toggles linewise hybrid mode. |
Sub-commands for working with splitview,
| Sub-command | Arguments | Description | |------------------|---------------------|------------------------------------------| | splitOpen | buffer, integer | Opens splitview for buffer. | | splitClose | none | Closes any open splitview. | | splitRedraw | none | Updates splitview contents. |
Sub-commands for manual preview updates,
| Sub-command | Arguments | Description | |------------------|---------------------|------------------------------------------| | render | buffer, integer | Renders preview for buffer. | | clear | buffer, integer | Clears preview for buffer. | | Render | none | Updates preview of all active buffers. | | Clear | none | Clears preview of all active buffer. |
Sub-commands for bug report,
| Sub-command | Arguments | Description | |------------------|---------------------|-------------------------------------------| | traceExport | none | Exports trace logs to markview_log.txt. | | traceShow | none | Shows trace logs in a window. |
>[!TIP]
buffer defaults to the current buffer. So, you can run commands on the current buffer without providing the buffer.
>> :Markview toggle "Toggles preview of the current buffer.
โ Contributing to the projects
If you have time and want to make this project better, consider helping me fix any of these issues,
- [ ] Add support for more filetypes in the internal icon provider.
- [ ] Optimization of
require("markview.renderers.markdown").output(). - [ ] Optimization of the table renderer.
- [ ] Stricter logic to reduce preview redraws.
- [X] Make
splitviewupdate as little content as possible. - [X] Make the help files/wiki more beginner friendly.
[^1]: The value of the linked group is used literally. So, manually changing the link group wouldn't work for this. [^2]: The value of MarkviewCode is used for the background. So, changing either of the linked group wouldn't affect these.