Giter VIP home page Giter VIP logo

markdown-preview's Introduction

markdown-preview

Markdown preview made easy (with live update).

Installation

  npm install -g markdown-preview

Usage

  markdown-preview [options] <filename>

Options

-h, --help                   output usage information
-V, --version                output the version number
-P, --parser <parser>        use markdown parser, remark | marked | showdown
-p, --port <port>            server port (defaults to 3333)
-b, --browser <browser>      browser name to open
-c, --css <name>             use customize css file for styling
-w, --width <width>          limit the width of the document (defaults to 800px)
-i, --highlight <highlight>  set highlight style
-t, --timeout <seconds>      exit preview if idle (defaults to 3s)
-o, --output <filename>      write to file

Code highlight style list

https://github.com/isagalaev/highlight.js/tree/master/src/styles

markdown-preview's People

Contributors

gazliddon avatar guilhermegregio avatar jshawl avatar michaelpaulukonis avatar qnp avatar sugarshin avatar yuanchuan 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  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  avatar  avatar  avatar

markdown-preview's Issues

'yuanchuan' is not in the npm registry

sudo npm install -g markdown-preview giving following error

npm ERR! 404 'yuanchuan' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it

Cannot enter filepath

Say I am in /var/www, and I want to preview /var/www/Boombox/README.md.

I run

$ markdown-preview Boombox/README.md

There is no error, but http://localhost:3333/README.md shows a blank page.

Is there any good way to get this to work?

Also, interestingly, if I cd to /usr/local/lib/node_modules/markdown-preview, and attempt to preview my README with an absolute filename...

$ cd /usr/local/lib/node_modules/markdown-preview
$ markdown-preview /var/www/Boombox/README.md 

now http://localhost:3333/README.md shows the preview for markdown-preview/README.md! Basically, the path is stripped from the filename argument. This seems like a separate issue, but I'm not sure.

TypeError on Windows

I get the following error when I try to run markdown-preview

C:\Users\Name\Documents\mips-rsa>markdown-preview README.md

C:\Users\Name\AppData\Roaming\npm\node_modules\markdown-preview\lib\parser.js:9
var converter = new showdown.converter();
                ^
TypeError: undefined is not a function
    at Object.<anonymous> (C:\Users\Name\AppData\Roaming\npm\node_modules\markdown-preview\lib\parser.js:9:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\Users\Name\AppData\Roaming\npm\node_modules\markdown-preview\lib\server.js:13:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

I use Windows 8.1 x64
The installation appears to work fine

C:\Users\Name>npm install -g markdown-preview
npm http GET https://registry.npmjs.org/markdown-preview
npm http 304 https://registry.npmjs.org/markdown-preview
npm http GET https://registry.npmjs.org/open
npm http GET https://registry.npmjs.org/node-watch
npm http GET https://registry.npmjs.org/showdown
npm http GET https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/node-watch
npm http 304 https://registry.npmjs.org/showdown
npm http 304 https://registry.npmjs.org/open
C:\Users\Name\AppData\Roaming\npm\markdown-preview -> C:\Users\Name\AppData\Roaming\npm\node_modules\markdown-preview\bin\markd
own-preview
[email protected] C:\Users\Name\AppData\Roaming\npm\node_modules\markdown-preview
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Github Flavored Markdown

Adding Github Flavored Markdown would be a nice touch. Right now I am using your previewer with vim for simple markup previewing. It makes it nice and lightweight for my needs vs the much more complex solutions. Just a thought.

Add a stackedit flavoured preview

Among all the markdown parsers and previewers I've encountered, this one is the best.
But I was wondering, in https://stackedit.io (source code), @benweet implements at least one feature most markdwon flavours don't, it's "LaTeX mathematical expressions using MathJax". I find this and some other features extremely useful but I wish I could use them with my own text-editor. I think that adding stackedit as a parser for markdown-preview will be great. Unfortunately I don't know enough JavaScript to make a PR, yet I couldn't not resist sharing the idea.

I'll be glad to hear your thoughts.

Markdown-preview `-h` option does not output help info

$ markdown-preview -h
returns error: option-h, --highlight ' argument missing`.

This is because the -h option is mapped to the --highlight argument, instead of the --help argument like the docs say.

See the --help output:

$ markdown-preview --help
  Usage: markdown-preview [options] <filename>
  Options:
    -h, --help                   output usage information
    -V, --version                output the version number
    -m, --marked                 use marked to parse markdown
    -p, --port <port>            server port (defaults to 3333)
    -c, --css <name>             use customize css file for styling
    -h, --highlight <highlight>  set highlight style

Let me know if you need more info.

Add --browser flag

Please let me choose which browser to open :) I'd like to have chromium open with the --new-window flag, but don't want to set that as default in xdg. You can simply pass that as second parameter to open().

Can't open non-local files

Using node v0.10.5 and markdown-preview v0.2.6 on Windows 7.

I am unable to open non-local files specified with the full-path.
Local files open just fine, but any file specified with a relative or full-path return Cannot open file <name>. (where <name> is the filename).

Looking at the source, the filename is set via

var filename = process.argv[2] && path.join(process.cwd(), process.argv[2])

This is equivalent to var filename = path.join(process.cwd(), process.argv[2]) since the parameter is always truthy.

There is no check to see if the file exists as provided.

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.