GitLab Kramdown

This is an unofficial gem that implements GitLab flavored Markdown extensions on top of Kramdown

GitLab Flavored Markdown extensions support

This is a list of GitLab Flavored Markdown (GFM) extensions and their status of support on this gem:

GFM Extensions Implemented?
Newlines No
Multiple underscores in words Kramdown
Headers with Anchors Yes
URL auto-linking No
Multiline Blockquote Yes
Code and Syntax Highlighting Yes
Inline Diff No
Emoji No
Special GitLab references Yes
Task Lists No
Videos No
Math No
Colors No
Mermaid No

Note: Extensions marked as Kramdown in the Implemented? means behavior already exists in Kramdown flavor.

Configuration parameters

Parameter Default Description
gitlab_url https://gitlab.com GitLab instance URL to build reference links
linkable_headers true Generate anchor tags with headers?

Usage example

To use this gem you're also required to install Kramdown. This gem will hook into Kramdown and provide custom parser.

require 'kramdown'
require 'gitlab_kramdown'

source = "# GFM example\n\nWe support custom extensions like:\n\n>>>\nThis is a multiline\nBlockquote\n\nUsing `>>>` as delimiter \n>>> \n"

Kramdown::Document.new(source, input: 'GitlabKramdown').to_html

To have also syntax highlighting using the same engine GitLab use, you need to define the highlighter as :rouge:

Kramdown::Document.new(source, input: 'GitlabKramdown', syntax_highlighter: :rouge).to_html

Contributing to gitlab_kramdown

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright (c) 2018 Gabriel Mazetto. See LICENSE.txt for further details.