Glance Vim
Do you know the number of Markdown flavours in the world? Everyone has an own flavour. It's hard to find the suitable Markdown previewer for your own flavored Markdown.
Glance Vim is YOUR previewer. You do not to wander anymore. Because this plugin provides a mechanism to customize renderer using markdown-it plugins.
If you want to use emoji in the markdown, then you just need to append markdown-it-emoji
to g:glance#plugins
let g:glance#plugins = ['https://esm.sh/markdown-it-emoji']
The renderer dynamically loads your plugin with dynamic import in Deno, then it renders the buffer content with markdown-it, and finally it sends the HTML document to the browwser.
Of couse, Glance Vim also provide features as follows.
- Spy the cursor motion in Vim.
- Append custom preamble in a head of HTML output.
- Synchronize content between the buffer and the browser.
- Offline mode, Deno caches the markdown-it plugins.
Let's write document in your own flavoured Markdown.
Installation
This plugin requires denops.vim and Deno.
Plug 'vim-denops/denops.vim'
Plug 'tani/glance-vim'
Usage
Please hit the command :Glance
in Vim and open http://localhost:8765
in the browser.
g:glance#server_port (8765)
is a port number to serve the previewer.g:glance#markdown_plugins ([])
is a list of URLs for the markdown-it plugins.g:glance#markdown_html (v:false)
is a boolean value to be enable HTML tags in markdown.g:glance#markdown_linkify (v:false)
is a boolean vlaue to render URLs asa
elments .g:glance#markdown_breaks (v:false)
is a boolean vlaue to convert newlines intobr
elements.g:glance#stylesheet ('')
is a string, which will be appended as a CSS stylesheet..
Advanced Usage
Glance Vim has an interface to extend the MarkdownIt renderer in TypeScript.
Step1: Set path of configuration file g:glance#config
such as ~/.config/glance/init.ts
let g:glance#config = extend('~/.config/glance/init.ts')
Step2: Write a configuration in TypeScript.
// ~/.config/glance/init.ts
import markdownItEmoji from 'https://esm.sh/markdown-it-emoji'
import MarkdownIt from 'https://esm.sh/markdown-it'
export function createMarkdownRenderer(md: MarkdownIt): MarkdownIt {
return md.use(markdownItEmoji);
}
Related Plugins
Copyright and License
Copyrihgt (c) 2022 TANIGUCHI Masaya. All rights reserved. This plugin is released under MIT License