Skip to content

yulongsun/vscode-markdown-preview-showdown

 
 

Repository files navigation

MDPS: MarkDown-Preview-Showdown

markdown-preview-showdown

A excellent markdown preview vscode extension with showdowns that converte markdown content to preview html.

If you think the vscode extension can help you or also hope to encourage the author, click on the top right corner to give me a Star⭐️.

Features

MarkDown-Preview-Showdown(MDPS) is an vscode extension that preview markdown content as HTML and provides you with many useful functionalities such as plantuml, mermaid, LaTeX math and AsciiMath, TOC, export HTML, export PDF etc.

MDPS converte markdown content to html that using the @jhuix/showdowns npm package. See to Demo Features:

features-gif

@jhuix/showdowns is a lib that make markdown to html with some extensions of showdown.js. And showdown.js is a Javascript Markdown to HTML converter, based on the original works by John Gruber. For more information, refer to the following document:

Requirements

For local rendering plantuml

When local rendering plantuml requires Java support, so Java environment (JDK or JRE) needs to be installed and the Java executor directory needs to be set to the global path environment variable for the extension to work:

  • JAVA_HOME: Java SDK installed directory (must have a bin sub-directory)
  • Windows example: C:\Program Files\Java\jdk1.8.0_101)
  • macOS example: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
  • PATH: the global path environment variable
  • Windows example: PATH=%PATH%;%JAVA_HOME%\bin -macOS example: PATH=$PATH:$JAVA_HOME/bin

If you want to use PlantUML's functionality that requires GraphViz, you need to download and install it, and to set the GRAPHVIZ_DOT environment variable, as explained here:

  • GRAPHVIZ_DOT: Path for the dot executable binary
  • Windows example: C:\Program Files\Graphviz\bin\dot.exe
  • macOS example: /usr/local/Cellar/graphviz/2.38.0_1/bin/dot

After setting these environment variables you need to restart VSCode for the extension to work.

For export PDF or PNG or JPEG:

When markdown-preview-showdown.usePuppeteerCore setting is true, this extension require puppeteer-core package (It has been integrated into the MDPS extension) and google chrome browser or chrome-location package, and chrome.exe program path is set to markdown-preview-showdown.chromePath. The chrome-location globally installed by npm:

    npm install -g chrome-location

When markdown-preview-showdown.usePuppeteerCore setting is false, this extension require puppeteer package. The puppeteer globally installed by npm:

    npm install -g puppeteer

Install from VS Code (Recommended)

Open vscode editor, then search markdown-preview-showdown in extensions, then click Install button.

Extension Settings

This extension contributes the following settings:

  • markdown-preview-showdown.autoPreview:

    Automatic preview markdown file, default false.

  • markdown-preview-showdown.flavor:

    Flavor of preview html page, you can choose one from ["github", "ghost", "vanilla"], default is "github" flavor.

  • markdown-preview-showdown.fontSize:

    Custom font size of preview page, default "14" px.

  • markdown-preview-showdown.scrollSync:

    Automatic scroll sync, default true.

  • markdown-preview-showdown.maxContentSize:

    When markdown content size exceeds 'maxContentSize' value, compress the content with brotli during message transmission, default 32768(32K) Bytes.

  • markdown-preview-showdown.mermaidTheme:

    Mermaid theme, you can choose one from ["default", "dark", "forest", "neutral"], default is "default" theme.

  • markdown-preview-showdown.vegaTheme:

    Vega theme, you can choose one from ["excel", "ggplot2", "quartz", "vox", "dark"], default is "vox" theme.

  • markdown-preview-showdown.plantumlRenderMode:

    The mode of rendering plant UML diagram, you can choose one from ["local", "remote"]: the default mode is "local", which means local rendering, but local rendering requires Java support, so Java environment needs to be installed and the Java executor directory needs to be set to the global path environment variable; while the mode "remote" means remote rendering, which means the setting item of plantumlWebsite needs to be set as the remote rendering URL.

  • markdown-preview-showdown.plantumlWebsite:

    When the setting item of plantumlrendermode is mode "remote", the remote rendering website to be set, default web site is "www.plantuml.com/plantuml".

  • markdown-preview-showdown.usePuppeteerCore:

    If set to true, then locally installed puppeteer-core will be required. Otherwise, the puppeteer globally installed by npm install -g puppeteer will be required, defualt true.

  • markdown-preview-showdown.puppeteerWaitForTimeout:

    Puppeteer waits for a certain timeout in milliseconds before the document export, default false.

  • markdown-preview-showdown.chromePath:

    Chrome executable path, which is used for Puppeteer export. Leaving it empty means the path will be found automatically.

Keybindings

OS Key Command
WINDOWS ctrl+shift+v ctrl+shift+v openPreview
MAC cmd+shift+v cmd+shift+v openPreview

Release Notes

Please see the release-notes page.

License

MIT License

Copyright (c) 2019-present, Jhuix (Hui Jin)

Packages

No packages published

Languages

  • TypeScript 63.8%
  • JavaScript 28.4%
  • HTML 5.1%
  • CSS 2.7%