Markdown-Edit icon indicating copy to clipboard operation
Markdown-Edit copied to clipboard

Render GFM as on GitHub

Open borekb opened this issue 9 years ago • 6 comments

Right now, GFM rendering ("GitHubMarkdown": true) quite close to GitHub but not entirely, e.g., the task lists are not rendered as checkboxes. Would there be a way to make "GitHubMarkdown" to really render like on GitHub?

borekb avatar Feb 02 '16 12:02 borekb

The checkbox functionality (last I checked) is not supported in Pandoc (MDE's GitHub markdown generator).

Also, it use to be the only place checkboxes worked were in issues (don't know if that's still the case). That's because checking the box actually updates the issue. I've used that mechanism in the past as a todo list for finishing up issues.

GitHub publishes their Markdown engine, but it's written in Ruby. Ruby on Windows is possible but it requires extensive setup. It's an added complexity I'm not willing to take on.

There are JavaScript versions but I've found the rendering quality to be buggy.

Pandoc is the robust, reliable, self-contained and actively maintained by the same guy who wrote the CommonMark reference engines.

It might be worth adding a feature request to the Pandoc project.

mike-ward avatar Feb 02 '16 14:02 mike-ward

Thanks for the comments. I have encountered several differences in local (Pandoc) and eventual GitHub rendering already and it's always a bit unpleasant but as you say, if that's the best rendering engine then so be it.

I've seen some other editor to directly call GitHub API to get the preview but that would be arguably quite slow.

borekb avatar Feb 02 '16 14:02 borekb

The GitHub API method is surprisingly fast. It is, however, rate limited (100 requests per hour).

Differences in output from various Markdown engines are what prompted the CommonMark specification. Markdown appears, "easy", but is surprisingly nuanced and not well specified.

mike-ward avatar Feb 02 '16 14:02 mike-ward

I am following CommonMark quite closely but they didn't even release the 1.0 yet and that is the "simple" part - then will come extensions and other things than I think are much more controversial and will be hard to settle on. Let's see what they can do..

BTW if you let your users authenticate the GitHub API requests, the rate limit is much higher there.

borekb avatar Feb 02 '16 16:02 borekb

I've lost too many years of my life to OAuth authentication in my twitter app :wink:

I'm a bit wary of relying on GitHub for rendering. It requires an Internet connection and GitHub being responsive. A lot of moving parts and when it fails, explaining to users might be difficult.

mike-ward avatar Feb 02 '16 16:02 mike-ward

Agree. Local is the way to go, shame that there's no good library except the official Ruby one (yes, Ruby is a pain on Windows).

borekb avatar Feb 02 '16 16:02 borekb