less-style markdown viewer for UNIX systems

后端 未结 9 1455
刺人心
刺人心 2020-12-22 21:39

I have a Markdown string in JavaScript, and I\'d like to display it (with bolding, etc) in a less (or, I suppose, more)-style viewer for the comman

9条回答
  •  半阙折子戏
    2020-12-22 22:27

    I'll post my unix page answer here, too:

    An IMHO heavily underestimated command line markdown viewer is the markdown-cli.

    Installation

    npm install markdown-cli --global
    

    Usage

    markdown-cli 
    

    Features

    Probably not noticed much, because it misses any documentation...
    But as far as I could figure out by some example markdown files, some things that convinced me:

    • handles ill formatted files much better (similarly to atom, github, etc.; eg. when blank lines are missing before lists)
    • more stable with formatting in headers or lists (bold text in lists breaks sublists in some other viewers)
    • proper table formatting
    • syntax highlightning
    • resolves footnote links to show the link instead of the footnote number (not everyone might want this)

    Screenshot

    example.png

    Drawbacks

    I have realized the following issues

    • code blocks are flattened (all leading spaces disappear)
    • two blank lines appear before lists

提交回复
热议问题