diff --git a/README.md b/README.md index 28c5cff..0a09de5 100644 --- a/README.md +++ b/README.md @@ -4,33 +4,33 @@ ### Introduction -> It only works on vim >= 8.1 and neovim +> It only works on Vim >= 8.1 and Neovim -Preview markdown on your modern browser with synchronised scrolling and flexible configuration +Preview Markdown in your modern browser with synchronised scrolling and flexible configuration. Main features: -- Cross platform (macos/linux/windows) +- Cross platform (MacOS/Linux/Windows) - Synchronised scrolling - Fast asynchronous updates -- [Katex](https://github.com/Khan/KaTeX) for typesetting of math -- [Plantuml](https://github.com/plantuml/plantuml) +- [KaTeX](https://github.com/Khan/KaTeX) for typesetting of math +- [PlantUML](https://github.com/plantuml/plantuml) - [Mermaid](https://github.com/knsv/mermaid) - [Chart.js](https://github.com/chartjs/Chart.js) -- [sequence-diagrams](https://github.com/bramp/js-sequence-diagrams) -- [flowchart](https://github.com/adrai/flowchart.js) +- [js-sequence-diagrams](https://github.com/bramp/js-sequence-diagrams) +- [Flowchart](https://github.com/adrai/flowchart.js) - [dot](https://github.com/mdaines/viz.js) -- [Toc](https://github.com/nagaozen/markdown-it-toc-done-right) -- Emoji +- [Table of contents](https://github.com/nagaozen/markdown-it-toc-done-right) +- Emojis - Task lists - Local images - Flexible configuration -**Note** it's no need `mathjax-support-for-mkdp` plugin for typesetting of math +**Note** the plugin `mathjax-support-for-mkdp` is not needed for typesetting math. -![screenshot](https://user-images.githubusercontent.com/5492542/47603494-28e90000-da1f-11e8-9079-30646e551e7a.gif) +![animation of Markdown Preview with its own README.md](https://user-images.githubusercontent.com/5492542/47603494-28e90000-da1f-11e8-9079-30646e551e7a.gif) -### install & usage +### Installation & Usage Install with [vim-plug](https://github.com/junegunn/vim-plug): @@ -52,7 +52,7 @@ call dein#add('iamcco/markdown-preview.nvim', {'on_ft': ['markdown', 'pandoc.mar \ 'build': 'sh -c "cd app && yarn install"' }) ``` -Or with minpac: +Or with [minpac](https://github.com/k-takata/minpac): ```vim call minpac#add('iamcco/markdown-preview.nvim', {'do': 'packloadall! | call mkdp#util#install()'}) @@ -64,7 +64,7 @@ Place this in your `.vimrc` or `init.vim`, ```vim Plugin 'iamcco/markdown-preview.nvim' ``` -... then run the following in vim (to complete the `Plugin` installation): +... then run the following in Vim (to complete the `Plugin` installation): ```vim :source % :PluginInstall @@ -109,24 +109,13 @@ use({ use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }) ``` -Or with [Lazy.nvim](https://github.com/folke/lazy.nvim): - -```lua --- install without yarn or npm -{ - "iamcco/markdown-preview.nvim", - ft = {"markdown"}, - build = function() vim.fn["mkdp#util#install"]() end, -} -``` - -Or by hand +Or by hand: ```vim use {'iamcco/markdown-preview.nvim'} ``` -add plugin in `~/.local/share/nvim/site/pack/packer/start/` directory: +add plugin to the `~/.local/share/nvim/site/pack/packer/start/` directory: ```vim cd ~/.local/share/nvim/site/pack/packer/start/ @@ -136,39 +125,39 @@ yarn install yarn build ``` Please make sure that you have installed `node.js` and `yarn`. -Open `nvim` and run `:PackerInstall` to make it workable +Open `nvim` and run `:PackerInstall` to make it work. ### MarkdownPreview Config: ```vim -" set to 1, nvim will open the preview window after entering the markdown buffer +" set to 1, nvim will open the preview window after entering the Markdown buffer " default: 0 let g:mkdp_auto_start = 0 -" set to 1, the nvim will auto close current preview window when change -" from markdown buffer to another buffer +" set to 1, the nvim will auto close current preview window when changing +" from Markdown buffer to another buffer " default: 1 let g:mkdp_auto_close = 1 -" set to 1, the vim will refresh markdown when save the buffer or -" leave from insert mode, default 0 is auto refresh markdown as you edit or +" set to 1, Vim will refresh Markdown when saving the buffer or +" when leaving insert mode. Default 0 is auto-refresh Markdown as you edit or " move the cursor " default: 0 let g:mkdp_refresh_slow = 0 -" set to 1, the MarkdownPreview command can be use for all files, -" by default it can be use in markdown file +" set to 1, the MarkdownPreview command can be used for all files, +" by default it can be use in Markdown files only " default: 0 let g:mkdp_command_for_global = 0 -" set to 1, preview server available to others in your network -" by default, the server listens on localhost (127.0.0.1) +" set to 1, the preview server is available to others in your network. +" By default, the server listens on localhost (127.0.0.1) " default: 0 let g:mkdp_open_to_the_world = 0 -" use custom IP to open preview page -" useful when you work in remote vim and preview on local browser -" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9 +" use custom IP to open preview page. +" Useful when you work in remote Vim and preview on local browser. +" For more details see: https://github.com/iamcco/markdown-preview.nvim/pull/9 " default empty let g:mkdp_open_ip = '' @@ -179,26 +168,26 @@ let g:mkdp_open_ip = '' " default: '' let g:mkdp_browser = '' -" set to 1, echo preview page url in command line when open preview page +" set to 1, echo preview page URL in command line when opening preview page " default is 0 let g:mkdp_echo_preview_url = 0 -" a custom vim function name to open preview page -" this function will receive url as param +" a custom Vim function name to open preview page +" this function will receive URL as param " default is empty let g:mkdp_browserfunc = '' -" options for markdown render -" mkit: markdown-it options for render -" katex: katex options for math +" options for Markdown rendering +" mkit: markdown-it options for rendering +" katex: KaTeX options for math " uml: markdown-it-plantuml options " maid: mermaid options -" disable_sync_scroll: if disable sync scroll, default 0 +" disable_sync_scroll: whether to disable sync scroll, default 0 " sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle' -" middle: mean the cursor position alway show at the middle of the preview page -" top: mean the vim top viewport alway show at the top of the preview page -" relative: mean the cursor position alway show at the relative positon of the preview page -" hide_yaml_meta: if hide yaml metadata, default is 1 +" middle: means the cursor position is always at the middle of the preview page +" top: means the Vim top viewport always shows up at the top of the preview page +" relative: means the cursor position is always at relative positon of the preview page +" hide_yaml_meta: whether to hide YAML metadata, default is 1 " sequence_diagrams: js-sequence-diagrams options " content_editable: if enable content editable for preview page, default: v:false " disable_filename: if disable filename header for preview page, default: 0 @@ -217,11 +206,11 @@ let g:mkdp_preview_options = { \ 'toc': {} \ } -" use a custom markdown style must be absolute path +" use a custom Markdown style. Must be an absolute path " like '/Users/username/markdown.css' or expand('~/markdown.css') let g:mkdp_markdown_css = '' -" use a custom highlight style must absolute path +" use a custom highlight style. Must be an absolute path " like '/Users/username/highlight.css' or expand('~/highlight.css') let g:mkdp_highlight_css = '' @@ -240,7 +229,7 @@ let g:mkdp_images_path = /home/user/.markdown_images let g:mkdp_filetypes = ['markdown'] " set default theme (dark or light) -" By default the theme is define according to the preferences of the system +" By default the theme is defined according to the preferences of the system let g:mkdp_theme = 'dark' ``` @@ -270,7 +259,7 @@ Commands: ### Custom Examples -**Toc:** +**Table of contents** > one of @@ -285,7 +274,7 @@ Commands: ![image](https://user-images.githubusercontent.com/5492542/47603494-28e90000-da1f-11e8-9079-30646e551e7a.gif =400x200) ``` -**plantuml:** +**PlantUML:** @startuml Bob -> Alice : hello @@ -297,7 +286,7 @@ Or Bob -> Alice : hello ``` -**katex:** +**KaTeX:** $\sqrt{3x-1}+(1+x)^2$ @@ -332,7 +321,7 @@ Or China-->Andrew: How are you? Andrew->>China: I am good thanks! ``` -**flowchart:** +**Flowchart:** ``` flowchart st=>start: Start|past:>http://www.google.com[blank] @@ -437,7 +426,7 @@ There is a button hidden in the header to change the theme. Place your mouse ove #### *How can I pass CLI options to the browser, like opening in a new window?* -Add the following to your NVIM init script: +Answer: Add the following to your Neovim init script: *Linux* ```vimscript @@ -457,11 +446,11 @@ Replace `firefox` with `chrome` if you prefer. Both browsers recognize the `--ne ``` Replace `Firefox` with `Google\ Chrome` or `Brave\ Browser` if you prefer. They all recognize the `--new-window` option. -### About vim support +### About Vim Support Vim support is powered by [@chemzqm/neovim](https://github.com/neoclide/neovim) -### Reference +### References - [coc.nvim](https://github.com/neoclide/coc.nvim) - [@chemzqm/neovim](https://github.com/neoclide/neovim) @@ -483,4 +472,4 @@ Vim support is powered by [@chemzqm/neovim](https://github.com/neoclide/neovim) ![btc](https://img.shields.io/keybase/btc/iamcco.svg?style=popout-square) -![image](https://user-images.githubusercontent.com/5492542/42771079-962216b0-8958-11e8-81c0-520363ce1059.png) +![WeChat and AliPay](https://user-images.githubusercontent.com/5492542/42771079-962216b0-8958-11e8-81c0-520363ce1059.png)