GithubHelp home page GithubHelp logo

tani / vim-glance Goto Github PK

View Code? Open in Web Editor NEW
37.0 2.0 6.0 81 KB

Preview document wrtting in YOUR markdown and asciidoc, POD.

HTML 1.82% TypeScript 52.87% JavaScript 4.00% Vim Script 4.13% Lua 37.18%
markdown vim deno neovim pod denops vim-denops

vim-glance's Introduction

vim-glance

UPDATE: The glance-vim now supports Asciidoc and POD file types. You can preview these file types within the vim editor by typing :Glance in a buffer that houses these specific file types.

The plugin offers a customization mechanism for rendering documents using markdown-it plugins. If you desire to use emojis within your markdown, you can simply append markdown-it-emoji plugin URL to the g:glance#plugins as shown below:

let g:glance#markdown_plugins = ['https://esm.sh/markdown-it-emoji']

The above plugin is loaded dynamically within Deno, consequently rendering the buffer content with markdown-it. The rendered content is subsequently dispatched as an HTML document to your browser.

Glance Vim offers various handy features:

  • Monitoring cursor movement within Vim.
  • Adding a custom preamble to the beginning of your HTML output.
  • Facilitating content synchronization between the buffer and the browser.
  • Operating in offline mode where Deno caches the markdown-it plugins.

Begin crafting your documents with your own flavored markdown.

Installation

This plugin requires denops.vim and Deno. For example, to use this plugin with vim-jetpack. Optionally, to use POD renderer, you need to install podium as well.

Jetpack 'vim-denops/denops.vim'
Jetpack 'tani/glance-vim'
Jetpack 'tani/podium'           "For POD file, optional

Usage

Please hit the command :Glance in Vim and open http://localhost:8765 in the browser. Use :GlanceStop to stop glance.

  • g:glance#server_hostname (127.0.0.1) is a hostname to serve the previewer.
  • g:glance#server_port (8765) is a port number to serve the previewer.
  • g:glance#server_open (v:true) is a boolean value to open the previewer automatically
  • 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 value to render URLs as a elments .
  • g:glance#markdown_breaks (v:false) is a boolean value to convert newlines into br 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 = expand('~/.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) 2023 TANIGUCHI Masaya. All rights reserved. This plugin is released under MIT License

vim-glance's People

Contributors

4513echo avatar github-actions[bot] avatar hasundue avatar lambdalisue avatar skanehira avatar tani avatar uga-rosa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vim-glance's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.