gjtorikian / commonmarker

Ruby wrapper for the comrak (CommonMark parser) Rust crate
MIT License
429 stars 82 forks source link

Extensions are not documented #52

Closed safinaskar closed 6 years ago

safinaskar commented 7 years ago

https://github.com/github/markup/blob/master/lib/github/markup/markdown.rb contains this:

CommonMarker.render_html(content, :GITHUB_PRE_LANG, [:tagfilter, :autolink, :table, :strikethrough])

What are this :tagfilter, :autolink, :table, :strikethrough? Extensions? Why they are not documented? I tried to grep sources for strikethrough, but I didn't find any documentation. If you don't want to document them, then at least please state its existence. Say in README that there is such thing as extension and one can pass list of extensions as a third argument to CommonMarker.render_html.

Also, it seems that libcmark doesn't support this extensions. So, this means that commonmarker is not simple wrapper for libcmark, commonmarker add significant additions to libcmark. So, this means that very first sentence of README is wrong (i. e. "Ruby wrapper for libcmark, the reference parser for CommonMark"). You should write instead that commonmarker is, say, "wrapper with extensions".

blackst0ne commented 6 years ago

I just came here while searching how to enable the table extension. +1 from me.

safinaskar commented 6 years ago

I still don't understand one thing. https://githubengineering.com/a-formal-spec-for-github-markdown/ says that github forked cmark for implementing extensions. So,

kivikakk commented 6 years ago

commonmarker depends on the forked cmark; see the submodule in the vendor directory.

We (GitHub) use this exact gem as part of github.com; when you require 'commonmarker', you're doing the precise same thing we're doing; the extensions in our forked cmark are consumed through commonmarker.

safinaskar commented 6 years ago

@kivikakk , thanks a lot for your answer. Please, write this in README. The very first sentence of the current README ("Ruby wrapper for libcmark") is wrong. If you need precise wording, you may take this:

--- README.md   2017-10-13 14:03:56.789326051 +0300
+++ R   2017-10-13 14:07:27.646749515 +0300
@@ -2,8 +2,8 @@

 [![Build Status](https://travis-ci.org/gjtorikian/commonmarker.svg)](https://travis-ci.org/gjtorikian/commonmarker) [![Gem Version](https://badge.fury.io/rb/commonmarker.svg)](http://badge.fury.io/rb/commonmarker)

-Ruby wrapper for [libcmark](https://github.com/jgm/CommonMark),
-the reference parser for CommonMark. It passes all of the C tests, and is therefore spec-complete. It also provides unique extensions to the CommonMark spec, such as support for tables, strikethroughs, and autolinking.
+Ruby wrapper for [Github's fork of libcmark](https://github.com/github/cmark),
+the reference parser for CommonMark. It passes all of the C tests, and is therefore spec-complete. It also provides unique extensions to the CommonMark spec (using code from Github's fork of libcmark), such as support for tables, strikethroughs, and autolinking.

 For more information on available extensions, see [the documentation below](#extensions).