Home

Awesome

📜 Markview.nvim

An experimental markdown previewer for Neovim.

<p align="center"> <a href="https://github.com/OXY2DEV/markview.nvim/wiki" style="font-size: 2rem;">Wiki page</a> </p>

hybrid_mode_showcase html_showcase screenshot screenshot_small custom_checkboxes

✨ Features

Markview.nvim comes with a ton of features such as,

And a lot more to come!

📦 Requirements

Optional:

🚀 Installation

Markview can be installed via your favourite package manager.

💤 Lazy.nvim

[!CAUTION] It is not recommended to lazy-load this plugin as it does that by default.

For lazy.lua users.

{
    "OXY2DEV/markview.nvim",
    lazy = false,      -- Recommended
    -- ft = "markdown" -- If you decide to lazy-load anyway

    dependencies = {
        -- You will not need this if you installed the
        -- parsers manually
        -- Or if the parsers are in your $RUNTIMEPATH
        "nvim-treesitter/nvim-treesitter",

        "nvim-tree/nvim-web-devicons"
    }
}

For plugins/markview.lua users.

return {
    "OXY2DEV/markview.nvim",
    lazy = false,      -- Recommended
    -- ft = "markdown" -- If you decide to lazy-load anyway

    dependencies = {
        -- You will not need this if you installed the
        -- parsers manually
        -- Or if the parsers are in your $RUNTIMEPATH
        "nvim-treesitter/nvim-treesitter",

        "nvim-tree/nvim-web-devicons"
    }
}

🦠 Mini.deps

local MiniDeps = require("mini.deps");

MiniDeps.add({
    source = "OXY2DEV/markview.nvim",

    depends = {
        -- You may not need this if you don't lazy load
        -- Or if the parsers are in your $RUNTIMEPATH
        "nvim-treesitter/nvim-treesitter",

        "nvim-tree/nvim-web-devicons"
    }
})

🌒 Rocks.nvim

You can install the plugin by running the following command.

:Rocks install markview.nvim

👾 Github releases

You can also download one of the releases.

🛸 Testing

If you don't mind a slightly unstable version of the plugin then you can use the dev branch.

🌇 Commands

Markview comes with a single command.

:Markview

It has the following sub-commands,

🚀 Hybrid mode

Hybrid mode is a new feature added to the plugin. It can be used for showcasing or editing files while you type.

It uses tree-sitter to remove decorations from a range. It will do the following,

Here's the recommended config to use this feature.

require("markview").setup({
    modes = { "n", "no", "c" }, -- Change these modes
                                -- to what you need

    hybrid_modes = { "n" },     -- Uses this feature on
                                -- normal mode

    -- This is nice to have
    callbacks = {
        on_enable = function (_, win)
            vim.wo[win].conceallevel = 2;
            vim.wo[win].concealcursor = "c";
        end
    }
})

Here's a minimal config for using this in insert-mode.

require("markview").setup({
    modes = { "n", "i", "no", "c" },
    hybrid_modes = { "i" },

    -- This is nice to have
    callbacks = {
        on_enable = function (_, win)
            vim.wo[win].conceallevel = 2;
            vim.wo[win].concealcursor = "nc";
        end
    }
})

🧭 Configuration

You can use the setup() function to change how the plugin looks.

local markview = require("markview");
local presets = require("markview.presets");

markview.setup({
    headings = presets.headings.glow_labels
});

vim.cmd("Markview enableAll");

This can also be used at runtime. So, you can hot-swap the config anytime you want!

Go ahead try running it.


You can configure the plugin in 2 ways,

📂 Presets

Presets are an easy way to change the looks of some part of the plugin.

Currently there are presets for the following items,

You can find more on presets on the wiki page.

🎨 Manual

The plugin was created with the sole purpose of being customisable.

So, you can change everything to fit your needs.

A simple example is given below,

require("markview").setup({
    headings = {
        enable = true,

        heading_1 = {
            style = "label",

            padding_left = " ",
            padding_right = " ",

            hl = "MarkviewHeading1"
        }
    }
});

You can check the wiki to learn more about configuration.

You can also check the Recipes for some simple examples.

🌃 highlight groups

To make configuration easier markview.nvim comes with the following highlight groups.

📦 Block quote

Block quotes have the following highlight group by default,

Various callouts/alerts use the following highlight groups,

🎯 Checkboxes

Checkbox use these highlight groups,

Markview also comes with 2 custom checkbox states,

[!Note] These are purely for custom notes and aren't taken from external tools(e.g. Obsidian).

💻 Code blocks & inline codes

Code blocks use the following highlight group,

Inline codes use the following highlight group,

🔖 Headings

Headings are highlighted with the following groups,

Signs are highlighted with the following groups,

📏 Horizontal rules

Horizontal rules use the following highlight groups for the gradient.

🔗 Links

Links use the following highlight groups,

📝 List items

List items use the following highlight groups,

📐 Tables

Tables use the following highlight group for the border,

For the column alignment markers these highlight groups are used,

⭐ Plugin showcase

showcase_1

<sub>Taken by <a href="https://github.com/scottmckendry">@scottmckendry</a></sub>

<!-- vim:nospell: -->