Kramdown – A Ruby library for parsing and converting a superset of Markdown
kramdown.gettalong.org
kramdown.gettalong.org
I switched the content team over to writing all of the pages for our sites in Kramdown and they're enjoying it much more than HTML. Easier for both them and us to maintain.
Last I was regularly programming in Ruby, the yardstick seemed to be RedCarpet. Has this changed?
Kramdown using Ruby makes it more accessible and has some cool options like table of contents generation that is more flexible than Pandoc. You can see some discussion of supporting Kramdown in pandoc. https://github.com/jgm/pandoc/issues/2711
Generally I think pandoc is the more mature tool, but I can see places where it might be a better call (especially if your app needs it as a library and you aren't willing to call a command (Pandoc).
Then I use XSLT to create kotlin bindings: https://github.com/fab1an/kotlin-electron-api
XSLT still rules for content-transformation.
Kramdown meanwhile seems to lack that configurability, and moreover has somewhat nonstandard support for in-line math. I switched to Pandoc on my Jekyll site and never looked back.
FYI: To configure kramdown such as using GitHub-flavored markdown (GFM) or using govspeak or slackdown etc. you use a new/different parser class. For example to use GFM in GitHub Pages / Jekyll in _config.yml add:
kramdown:
input: GFM
Cheers.Works for me.
* foo
* bar
* bat
* asdf
Results in: <ul>
<li>foo
<ul>
<li>bar</li>
<li>bat</li>
</ul>
</li>
<li>asdf</li>
</ul>Kramdown implemented this in a similar way to PHP Markdown Extra. https://kramdown.gettalong.org/syntax.html#definition-lists
That said, it's not very clean Markdown.
Again kramdown can - of course - handle nested lists (bulleted or numbered or even with nested code blocks and more). kramdown is just a little bit stricter about the whitespace indentation (your indentation has to line-up - that's all - no big deal really. Try it live here -> http://trykramdown.herokuapp.com
Repeat the process on a million documents (do a million markdown docs exist in one place?), and Kramdown might not be considered "fast" compared to other options...
Where Ruby fits, it's wonderful. Where it just doesn't fit, all of its niceness is overshadowed by its scaling issues.
I mean, if you need good threads, you probably shouldn't be on Ruby, but as far as I can tell its single-core performance is pretty okay compared to other scripting languages.
It's still the absolute best (most features I need in the standard library, or easy to use libraries, and easiest to use) thing I've ever used for working with manipulating large quantities of text (save for maybe Perl, but ew). I've started using Elixir when I need concurrency, but Ruby is still the language I'm most likely to use for most classes of problem.
by the way, i don't know how they compare with each other, but the speed of commonmark.js is blazing fast these days.
But yes, in Ruby there is a global namespace and open classes, so you can do pretty much whatever you want.
But in any language you'll find bad libraries. I mean I can write a go / rust / Java / whatever library that immediately segfault, panic or exit(1) when you invoke it. Does it mean any of those languages are bad?
The central question solved by Bundler is "what version of the gem am I using?" and the core issue addressed by RVM is "what version of Ruby." If you are coming from a tradition of packages for your programming language interpreter that are managed by the OS, and similarly language module packages that come from the OS, and you expect that pattern to just work with Ruby, then yeah, you are quite likely going to have a bad time. Ruby handles these issues internally out of necessity.
It does so because for most of us taking this stuff very seriously, we need to be able to run the latest version of the gem (or, any given arbitrary version that our own production release engineering process has settled on) with our chosen OS Distro with the Long-Term Support release. Long term support releases (or, for example, Debian stable releases) use packages that are frozen to a version at a point in time and are likely to be at least a year old. If your gem solves a problem for you but it legitimately hasn't been updated in more than a year, chances are good it's because there's someone else who has made another gem, solving the problem in a better way, and people have already moved on.
There is simply no way to address this concern on arbitrarily many OS Distros simultaneously without solving it generally in a way that eschews the OS package manager altogether. When you're committed to solving the problem without the OS package manager's help, bringing it back into the loop is more likely to get in the way than to solve any actual problem. So you find a lot of outdated packages for ruby libraries in OS package managers, when they are even provided at all.
I'm not sure if GP had problems with Ruby because of reliance on OS package managers, but if I was a betting man...
This is concern #2 from 12 factor methodology of development, Dependency Isolation: https://12factor.net
I am a Ruby dev, and one of the things I appreciate most about the language is that once I broke down the initial barriers we're talking about now, there was practically nothing stopping me from saying "I am a Ruby dev"
It was still years after that before I would dare to say I was a Rails dev, of course...
IMHO it is a feature if your language guides people that are at first just passive users to become devs and contribute to your project with issues and pull requests.
I second the massive comment below, though I personally prefer ruby-build + chruby over rvm these days.