有没有命令行实用程序来渲染GitHub风味的Markdown? [英] Is there a command line utility for rendering GitHub flavored Markdown?

查看:238
本文介绍了有没有命令行实用程序来渲染GitHub风味的Markdown?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一个命令行实用程序用于获取 GitHub风格的Markdown 文件和渲染它到HTML。



我使用GitHub wiki来创建网站内容。我已经克隆了我的服务器上的存储库,然后希望将其处理为正常的HTML。对我来说重要的是,出现在GitHub上的内容是我应该如何查找我的网站。我也想用 ~~~ 来使用fenced块,所以我不想使用标准的Markdown语法。



我看了一下JavaScript实时预览的思想,我可以把它挂接到Node.js,但他们说它已经过时了。我看过redcarpet库,但它看起来不像有一个命令行界面。



我滚动了我自己的解决方案,但是,因为没有解决方案

解决方案

我在Python中写了一个小的CLI并添加了GFM支持。它称为 Grip(Github自述即时预览)



安装它:

  $ pip install grip 

使用它,只需:

  $ grip 

然后访问 localhost:5000 ,查看 readme.md



您也可以指定自己的档案:

  $ grip CHANGES.md 

并更改端口:

  $ grip 8080 

当然,专门渲染GitHub-Flavored Markdown,可选择使用存储库上下文:

  $ grip --gfm  - context = username / repo issue.md 

显着的功能:


$ b



  • 在链接的文件之间导航(感谢 vladwing !)在2.0

  • 导出到单个文件(感谢 iliggio ! )在2.0中添加

  • 新功能:读取 stdin stdout 中添加



  • 有人在这里。 查看


    I'm wondering if there is a command line utility for taking a GitHub flavored Markdown file and rendering it to HTML.

    I'm using a GitHub wiki to create website content. I've cloned the repository on my server and would then like to process it into regular HTML. It's important to me that what appears on GitHub is exactly how it should look for my website. I'd also really like to use the fenced blocks with ~~~, so I'd rather not use standard Markdown syntax only.

    I've looked a bit into the JavaScript live preview thinking I could hook it into Node.js, but they say it is deprecated. I've looked at the redcarpet repository, but it doesn't look like it has a command line interface.

    I rolled my own solution, however, since no solution here is clearly better than the others, I'll leave the question without a selected answer.

    解决方案

    I wrote a small CLI in Python and added GFM support. It's called Grip (Github Readme Instant Preview).

    Install it with:

    $ pip install grip
    

    And to use it, simply:

    $ grip
    

    Then visit localhost:5000 to view the readme.md file at that location.

    You can also specify your own file:

    $ grip CHANGES.md
    

    And change port:

    $ grip 8080
    

    And of course, specifically render GitHub-Flavored Markdown, optionally with repository context:

    $ grip --gfm --context=username/repo issue.md
    

    Notable features:

    • Renders pages to appear exactly like on GitHub
    • Fenced blocks
    • Python API
    • Navigate between linked files (thanks, vladwing!) added in 2.0
    • Export to a single file (thanks, iliggio!) added in 2.0
    • New: Read from stdin and export to stdout added in 3.0

    Hope this helps someone here. Check it out.

    这篇关于有没有命令行实用程序来渲染GitHub风味的Markdown?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆