Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odlp/redcarpet-render-seeing_is_believing
Evaluates Ruby code in your markdown, for awesome examples
https://github.com/odlp/redcarpet-render-seeing_is_believing
markdown redcarpet syntax-highlighting
Last synced: 29 days ago
JSON representation
Evaluates Ruby code in your markdown, for awesome examples
- Host: GitHub
- URL: https://github.com/odlp/redcarpet-render-seeing_is_believing
- Owner: odlp
- License: mit
- Created: 2018-01-07T22:58:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-04T16:21:15.000Z (over 6 years ago)
- Last Synced: 2024-10-06T05:07:08.840Z (about 1 month ago)
- Topics: markdown, redcarpet, syntax-highlighting
- Language: Ruby
- Size: 130 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Redcarpet::Render::SeeingIsBelieving
[![Build Status](https://travis-ci.org/odlp/redcarpet-render-seeing_is_believing.svg?branch=master)](https://travis-ci.org/odlp/redcarpet-render-seeing_is_believing)
Powerup the Ruby examples in your markdown. Combines the excellent
[Redcarpet][redcarpet] (a markdown parser) with [Seeing Is Believing][sib],
which shows the evaluated result from each line of code.If your markdown includes a fenced code block with `ruby+` specified as the
language:```ruby+
animals = ["Aardvark", "Butterfly", "Camel"]
animals.map(&:upcase)
```Then you'll see the result of each line of code:
![Example HTML](example_app/example.png)
## Usage
Add the following line to your `Gemfile` and `bundle install`:
```ruby
gem "redcarpet-render-seeing_is_believing"
```Then `prepend` the module in your renderer:
```ruby
require "redcarpet/render/seeing_is_believing"
require "redcarpet"class MyCustomHtmlRenderer < Redcarpet::Render::HTML
prepend Redcarpet::Render::SeeingIsBelievingdef block_code(code, language)
""#{code}
end
endRedcarpet::Markdown.new(MyCustomHtmlRenderer, fenced_code_blocks: true).
render("some markdown!")
```or combine with [Rouge][rouge] syntax highlighter:
[rouge]: https://github.com/jneen/rouge
```ruby
require "redcarpet/render/seeing_is_believing"
require "redcarpet"
require "rouge"
require "rouge/plugins/redcarpet"class MyCustomHtmlRenderer < Redcarpet::Render::HTML
include Rouge::Plugins::Redcarpet
prepend Redcarpet::Render::SeeingIsBelieving
endRedcarpet::Markdown.new(MyCustomHtmlRenderer, fenced_code_blocks: true).
render("some markdown!")
```[redcarpet]: https://github.com/vmg/redcarpet
[sib]: https://github.com/JoshCheek/seeing_is_believing## Options
You can pass additional options after the `ruby+` language hint:
- `ruby+e`: Hints exceptions are expected, and should be displayed. Exceptions
are hidden by default.## TODO
- Allow comments to be scoped to specific lines
- Wrap comments to the following line when the overall length is greater than
80 chars