在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):dmarcotte/github-markdown-preview开源软件地址(OpenSource Url):https://github.com/dmarcotte/github-markdown-preview开源编程语言(OpenSource Language):Ruby 100.0%开源软件介绍(OpenSource Introduction):Local Github Markdown PreviewUse your favorite editor plus the usual edit/refresh cycle to quickly write and polish your markdown for Github. This program marries html-pipeline with the Listen file watcher to provide a high-fidelity preview (in your local browser, automatically updating on edit) of how Github will render your markdown. Installation
UsageGenerate a preview of how Github renders markdown files in a repository: $ github-markdown-preview <path/to/markdown/file.md> # writes <path/to/markdown/file.md.html>
Comment modeUse the
$ github-markdown-preview -c <path/to/comment/draft.md> # writes <path/to/comment/draft.md.html> Enable syntax highlighting for code blocksTo enable syntax highlighting for code blocks, you will need to install gem install github-linguist -v 3.3.1 # 3.3.1 is required
gem install rugged -v 0.23.0 # undeclared dependency of linguist Note that this install will fail unless your system meets the requirements needed to build its native extensions:
CodeHere's a sample file demonstrating how to call require 'github-markdown-preview'
# create a preview, which writes the source_file.md.html file to disk
preview = GithubMarkdownPreview::HtmlPreview.new('source_file.md')
# you can also configure your preview with a couple of options
preview = GithubMarkdownPreview::HtmlPreview.new('source_file.md', {
:delete_on_exit => true, # delete the preview when the program exits
:comment_mode => true, # render using the rules for Github comments/issues
:preview_file => 'custom_preview_file.html' # write preview to the given filename,
# rather than the default 'source_file.md.html'
})
# access the preview information
preview.source_file # returns 'source_file.md'
preview.preview_file # returns 'source_file.md.html'
# explicitly update the preview file from the source
preview.update
# watch the source file and update the preview on change
preview.watch # non-blocking watch
preview.watch! # blocking watch
# add a callback to be fired on update; add multiple listeners by calling again
preview.update { puts 'Preview updated!' }
# stop watching the file (only applies to non-blocking watch method)
preview.end_watch
# delete the preview file from disk
preview.delete Development$ bundle install
$ rake test Alternatively, to test with optional dependencies $ BUNDLE_GEMFILE=Gemfile.optional bundle install
$ BUNDLE_GEMFILE=Gemfile.optional rake test To run your development copy of the main script without installing it $ bundle exec bin/github-markdown-preview To install the your development copy to your system $ rake install ContributingContributions welcome! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论