Closed envygeeks closed 11 years ago
You probably want to use md2man instead, which relies on Redcarpet. However, the project is maintained at a much slower pace. Also, not all GitHub flavoured markdown can be translated to roff.
The impetus for this project was that:
Sure we could use MD2Man but somebody suggested that we use your project to support you so I was trying to expand your project to support our needs... that is if you would have wanted me to do the actual hard work of making it modular to do that and can't be translated to Roff is a subjective statement that itself implies that you cannot make a ruleset to what happens in those situations that is sane. As for the others:
I was never implying rid of Kramdown, I was implying support multiple markdown translators, this provides much better coverage than others and would put you at the top considering people can choose what they like.
gemspec.files
and are generated by Kramdown::Manpage::Tasks.Redcarpet::Render::ManPage
.I guess by DOM, I mean AST.
require 'kramdown'
doc = Kramdown::Document.new("* foo\n* bar\n\n> baz")
doc.root.children
# => [<kd:ul nil [<kd:li nil [<kd:p nil {:transparent=>true} [<kd:text "foo" nil>]>]>, <kd:li nil [<kd:p nil {:transparent=>true} [<kd:text "bar" nil>]>]>]>, <kd:blank "\n" nil>, <kd:blockquote nil [<kd:p nil [<kd:text "baz" nil>]>]>]
All nodes in the AST are Kramdown::Elements. An element can have:
type
: root
, p
, a
, ul
, ol
, li
, blockquote
, codeblock
, header
, codespan
, em
, strong
, blank
, typographic_sym
, etc.value
: aka it's contentchildren
: an Array of more elementsoptions
: (ex: <kd:header nil {:level=>2, :raw_text=>"Foo"}
)attr
(ex: <kd:a {"href"=>"http://bar.com/"} [<kd:text "Foo" nil>]>
)Using the above metadata, it's extremely simple to write a Converter class, which simply traverses the AST, convert elements into output Strings. This is why it took approximately three hours to write a kramdown -> roff Converter, using md2man and ronn as reference implementations.
To address the first:
To address the second:
You seem to keep trying to imply that Kramdown has a far superior API and whatever you are showing above does not prove it somehow has a better API because I could point out how easy it is to build a rendering engine for Redcarpet by way of simply sending you here: https://github.com/vmg/redcarpet/blob/master/lib/redcarpet/render_man.rb#L5 and pointing out it requires nothing more than inheriting a base class, building a few methods and then passing that renderer into Redcarpet. As a matter of fact, most modular developers would probably agree that Redcarpet has the superior API and Kramdown simply has a wider reaching API.
I've already looked at Redcarp::Render::ManPage
, and it only supports rendering a limited subset of markdown and roff, even less than what md2man supports.
The primary goal of this project is to use Kramdown to render markdown -> roff (thus the name kramdown-manpage), so that I can replace md2man/redcarpet with a JRuby friendly markdown->roff converter, and finally return to getting Ronin passing on TravisCI I do not want to be stuck supporting multiple markdown processors, as it is out of the scope for this project. You have already stated that you are tied to and prefer Redcarpet, so you should use Redcarpet::Render::ManPage
. If you really want to support all markdown parsers, you should consider writing a gem that abstracts away Ronn, md2man, kramdown-manpage, etc.
We don't use Kramdown on our sites, we prefer Redcarpet & Github-Markdown through html-pipeline. If you need help tell me where I can start and I'll be happy to help.