https://github.com/xijo/reverse_markdown
Ruby gem to convert html into markdown
https://github.com/xijo/reverse_markdown
Keywords from Contributors
activejob activerecord mvc rubygems feature-flag rspec rack test-coverage coverage-report coverage-library
Last synced: about 2 hours ago
JSON representation
Repository metadata
Ruby gem to convert html into markdown
- Host: GitHub
- URL: https://github.com/xijo/reverse_markdown
- Owner: xijo
- License: wtfpl
- Created: 2009-07-14T07:46:01.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2026-01-20T13:18:59.000Z (about 1 month ago)
- Last Synced: 2026-03-01T21:57:59.560Z (1 day ago)
- Language: Ruby
- Homepage:
- Size: 247 KB
- Stars: 665
- Watchers: 11
- Forks: 119
- Open Issues: 15
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
README.md
Summary
Transform html into markdown. Useful for example if you want to import html into your markdown based application.
Changelog
See Change Log
Limitations
A perfect HTML to Markdown conversion is not possible. HTML is far more expressive than Markdown - it supports tables with merged cells, arbitrary nesting, inline styles, and countless other features that have no Markdown equivalent.
This gem aims to provide good enough defaults for most common cases. It handles standard content well but does not attempt to solve every edge case. If you have highly specific conversion needs, you can write custom converters to handle them.
Requirements
- Nokogiri
- Ruby 2.7.0 or higher
Installation
Install the gem
[sudo] gem install reverse_markdown
or add it to your Gemfile
gem 'reverse_markdown'
Features
- Supports all the established html tags like
h1,h2,h3,h4,h5,h6,p,em,strong,i,b,blockquote,code,img,a,hr,li,ol,ul,table,tr,th,td,br,figure - Module based - if you miss a tag, just add it
- Can deal with nested lists
- Inline and block code is supported
- Supports blockquote
Usage
Ruby
You can convert html content as string or Nokogiri document:
input = '<strong>feelings</strong>'
result = ReverseMarkdown.convert input
result.inspect # " **feelings** "
Commandline
It's also possible to convert html files to markdown using the binary:
$ reverse_markdown file.html > file.md
$ cat file.html | reverse_markdown > file.md
Configuration
The following options are available:
unknown_tags(defaultpass_through) - how to handle unknown tags. Valid options are:pass_through- Include the unknown tag completely into the resultdrop- Drop the unknown tag and its contentbypass- Ignore the unknown tag but try to convert its contentraise- Raise an error to let you know
github_flavored(defaultfalse) - use github flavored markdown (yet only code blocks are supported)tag_border(default' ') - how to handle tag borders. valid options are:' '- Add whitespace if there is none at tag borders.''- Do not not add whitespace.
As options
Just pass your chosen configuration options in after the input. The given options will last for this operation only.
ReverseMarkdown.convert(input, unknown_tags: :raise, github_flavored: true)
Preconfigure
Or configure it block style on a initializer level. These configurations will last for all conversions until they are set to something different.
ReverseMarkdown.config do |config|
config.unknown_tags = :bypass
config.github_flavored = true
config.tag_border = ''
end
Related stuff
- Write custom converters - Wiki entry about how to write your own converter
- html_massage - A gem by Harlan T. Wood to convert regular sites into markdown using reverse_markdown
- word-to-markdown - Convert word docs into markdown while using reverse_markdown, by Ben Balter
- markdown syntax - The markdown syntax specification
- github flavored markdown - Githubs extension to markdown
- wmd-editor - Markdown flavored text editor
Thanks
Thanks to all contributors and all other helpers:
- Empact Ben Woosley
- harlantwood Harlan T. Wood
- aprescott Adam Prescott
- danschultzer Dan Schultzer
- Benjamin-Dobell Benjamin Dobell
- schkovich Goran Miskovic
- craig-day Craig Day
- grmartin Glenn R. Martin
- willglynn Will Glynn
Owner metadata
- Name: Johannes Opper
- Login: xijo
- Email: xijo@pm.me
- Kind: user
- Description:
- Website:
- Location: Berlin
- Twitter:
- Company: @good-hood-gmbh
- Icon url: https://avatars.githubusercontent.com/u/104711?v=4
- Repositories: 84
- Last ynced at: 2026-01-30T01:48:33.763Z
- Profile URL: https://github.com/xijo
GitHub Events
Total
- Pull request event: 7
- Fork event: 3
- Watch event: 28
- Issue comment event: 8
- Push event: 17
- Create event: 2
Last Year
- Pull request event: 2
- Fork event: 3
- Watch event: 17
- Issue comment event: 4
- Push event: 4
- Create event: 1
Committers metadata
Last synced: 2 days ago
Total Commits: 194
Total Committers: 44
Avg Commits per committer: 4.409
Development Distribution Score (DDS): 0.366
Commits in past year: 10
Committers in past year: 3
Avg Commits per committer in past year: 3.333
Development Distribution Score (DDS) in past year: 0.2
| Name | Commits | |
|---|---|---|
| Johannes Opper | x****o@g****e | 123 |
| Mal Curtis | m****l@s****m | 7 |
| Harlan T Wood | h****n@t****m | 7 |
| Shane Andrade | m****2@g****m | 4 |
| Masataka Pocke Kuwabara | k****a@p****e | 4 |
| Henry Poydar | h****r@g****m | 3 |
| rgould | r****d@g****m | 2 |
| anshul78 | 6****8 | 2 |
| unknown | x****o@.****) | 2 |
| Craig Day | c****y@z****m | 2 |
| Easy-D | e****1@g****m | 2 |
| Gustav Munkby | g****v@g****m | 2 |
| Olle Jonsson | o****n@g****m | 2 |
| Will Glynn | w****l@w****m | 2 |
| Dan Schultzer | d****n@d****m | 1 |
| Damien White | d****e@v****m | 1 |
| Anton Rieder | 1****r | 1 |
| AlexanderPruss | a****s@k****e | 1 |
| Faheem Mughal | f****l@a****m | 1 |
| Glen Stampoultzis | g****s@e****m | 1 |
| mizoryu | s****u@y****m | 1 |
| Markus Schirp | m****j@s****t | 1 |
| userhas404d | 2****d | 1 |
| gecunps | g****u@n****t | 1 |
| arunthampi | a****i@g****m | 1 |
| Suraj N. Kurapati | s****u@g****m | 1 |
| Stephen Roberts | s****s@g****m | 1 |
| Spyros Livathinos | l****s@g****m | 1 |
| Shiva Bhusal | h****a@g****m | 1 |
| Pat Allan | p****t@f****m | 1 |
| and 14 more... | ||
Committer domains:
- zendesk.com: 2
- gmx.de: 1
- sitepoint.com: 1
- thegoldensun.com: 1
- pocke.me: 1
- .(none): 1
- willglynn.com: 1
- dreamconception.com: 1
- visoftinc.com: 1
- kreuzwerker.de: 1
- artirix.com: 1
- envato.com: 1
- seonic.net: 1
- nelnet.net: 1
- freelancing-gods.com: 1
- staugaard.com: 1
- mike.is: 1
- kerricklong.com: 1
- github.com: 1
- general-scripting.com: 1
- gregoryjscott.com: 1
- mac.com: 1
- pieinsky.ca: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 41
Total pull requests: 69
Average time to close issues: about 1 year
Average time to close pull requests: 4 months
Total issue authors: 34
Total pull request authors: 52
Average comments per issue: 3.8
Average comments per pull request: 1.74
Merged pull request: 52
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 6
Past year average time to close issues: N/A
Past year average time to close pull requests: 1 day
Past year issue authors: 0
Past year pull request authors: 3
Past year average comments per issue: 0
Past year average comments per pull request: 0.17
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- bkazez (3)
- aprescott (3)
- drewish (2)
- benbalter (2)
- fauno (2)
- vanboom (1)
- shivabhusal (1)
- harlantwood (1)
- danschultzer (1)
- maestromac (1)
- movermeyer (1)
- burlesona (1)
- AlexanderPruss (1)
- coezbek (1)
- cainianhua (1)
Top Pull Request Authors
- xijo (6)
- harlantwood (3)
- stephencroberts (2)
- craig-day (2)
- Kevinrob (2)
- pocke (2)
- olleolleolle (2)
- pat (2)
- gagandeepsinghj (2)
- leon (2)
- Benjamin-Dobell (2)
- faheemmughal (2)
- schkovich (1)
- Sija (1)
- mudasobwa (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 12
-
Total downloads:
- rubygems: 185,357,030 total
- Total docker downloads: 899,025,654
- Total dependent packages: 51 (may contain duplicates)
- Total dependent repositories: 3,678 (may contain duplicates)
- Total versions: 113
- Total maintainers: 2
gem.coop: reverse_markdown
Map simple html back into markdown, e.g. if you want to import existing html data in your application.
- Homepage: http://github.com/xijo/reverse_markdown
- Documentation: http://www.rubydoc.info/gems/reverse_markdown/
- Licenses: WTFPL
- Latest release: 3.0.2 (published about 1 month ago)
- Last Synced: 2026-03-01T07:03:41.068Z (2 days ago)
- Versions: 36
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 92,673,900 Total
- Docker Downloads: 449,512,827
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.135%
- Docker downloads count: 0.249%
- Downloads: 0.291%
- Maintainers (2)
debian-13: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Documentation: https://packages.debian.org/trixie/ruby-reverse-markdown
- Licenses: wtfpl
- Latest release: 3.0.0-1 (published 19 days ago)
- Last Synced: 2026-02-13T13:19:08.268Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.308%
- Forks count: 0.576%
- Stargazers count: 0.655%
rubygems.org: reverse_markdown
Map simple html back into markdown, e.g. if you want to import existing html data in your application.
- Homepage: http://github.com/xijo/reverse_markdown
- Documentation: http://www.rubydoc.info/gems/reverse_markdown/
- Licenses: WTFPL
- Latest release: 3.0.2 (published about 1 month ago)
- Last Synced: 2026-03-01T21:32:11.252Z (1 day ago)
- Versions: 36
- Dependent Packages: 51
- Dependent Repositories: 3,678
- Downloads: 92,683,130 Total
- Docker Downloads: 449,512,827
-
Rankings:
- Docker downloads count: 0.308%
- Downloads: 0.379%
- Dependent repos count: 0.52%
- Dependent packages count: 0.53%
- Average: 1.025%
- Forks count: 2.107%
- Stargazers count: 2.307%
- Maintainers (2)
proxy.golang.org: github.com/xijo/reverse_markdown
- Homepage:
- Documentation: https://pkg.go.dev/github.com/xijo/reverse_markdown#section-documentation
- Licenses: wtfpl
- Latest release: v3.0.2+incompatible (published about 1 month ago)
- Last Synced: 2026-02-28T11:02:42.776Z (3 days ago)
- Versions: 32
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Forks count: 2.026%
- Stargazers count: 2.039%
- Average: 4.379%
- Dependent packages count: 6.508%
- Dependent repos count: 6.945%
ubuntu-23.10: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Licenses:
- Latest release: 1.4.0-1 (published 18 days ago)
- Last Synced: 2026-02-13T18:31:30.167Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Licenses:
- Latest release: 1.4.0-1 (published 18 days ago)
- Last Synced: 2026-02-13T07:21:48.580Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Licenses:
- Latest release: 1.4.0-1 (published 20 days ago)
- Last Synced: 2026-02-11T06:48:32.779Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Documentation: https://packages.debian.org/bullseye/ruby-reverse-markdown
- Licenses:
- Latest release: 1.4.0-1 (published 21 days ago)
- Last Synced: 2026-02-13T08:24:21.691Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-22.04: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Licenses:
- Latest release: 1.4.0-1 (published 18 days ago)
- Last Synced: 2026-02-13T13:24:38.595Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-reverse-markdown
- Homepage: https://github.com/xijo/reverse_markdown
- Documentation: https://packages.debian.org/bookworm/ruby-reverse-markdown
- Licenses:
- Latest release: 1.4.0-1 (published 19 days ago)
- Last Synced: 2026-02-12T23:39:46.640Z (19 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
Dependencies
- byebug >= 0 development
- codeclimate-test-reporter >= 0 development
- kramdown >= 0 development
- rake >= 0 development
- rspec >= 0 development
- simplecov >= 0 development
- nokogiri >= 0
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
Score: 31.1105631977944