Class: Kramdown::Parser::GitlabKramdown
- Inherits:
-
Kramdown
- Object
- Kramdown
- Kramdown::Parser::GitlabKramdown
- Includes:
- GitlabKramdown::Parser::Autolink, GitlabKramdown::Parser::Escape, GitlabKramdown::Parser::FencedBlockquote, GitlabKramdown::Parser::FencedCodeblock, GitlabKramdown::Parser::Header, GitlabKramdown::Parser::Label, GitlabKramdown::Parser::Reference, GitlabKramdown::Parser::Strikethrough
- Defined in:
- lib/kramdown/parser/gitlab_kramdown.rb
Overview
Used for parsing documents in GitLab Flavored Markdown like format.
This is not 100% compatible with GFM used in GitLab application as it includes extensions available only in kramdown.
Constant Summary
Constants included from GitlabKramdown::Parser::Strikethrough
GitlabKramdown::Parser::Strikethrough::STRIKETHROUGH_DELIM, GitlabKramdown::Parser::Strikethrough::STRIKETHROUGH_MATCH
Constants included from GitlabKramdown::Parser::Reference
GitlabKramdown::Parser::Reference::ALWAYS_FULL_NAMESPACE_FORMAT_REGEX, GitlabKramdown::Parser::Reference::FULL_NAMESPACE_FORMAT_REGEX, GitlabKramdown::Parser::Reference::NAMESPACE_EXTRACTION_PATTERN, GitlabKramdown::Parser::Reference::NAMESPACE_FORMAT_REGEX, GitlabKramdown::Parser::Reference::PATH_REGEX, GitlabKramdown::Parser::Reference::PROJECT_COMMIT_DIFF_PATTERN, GitlabKramdown::Parser::Reference::PROJECT_COMMIT_PATTERN, GitlabKramdown::Parser::Reference::PROJECT_ISSUE_PATTERN, GitlabKramdown::Parser::Reference::PROJECT_MERGE_REQUEST_PATTERN, GitlabKramdown::Parser::Reference::PROJECT_SNIPPET_PATTERN, GitlabKramdown::Parser::Reference::USER_GROUP_PATTERN
Constants included from GitlabKramdown::Parser::Label
GitlabKramdown::Parser::Label::PROJECT_LABEL_PATTERN
Constants included from GitlabKramdown::Parser::Header
GitlabKramdown::Parser::Header::ATX_HEADER_MATCH, GitlabKramdown::Parser::Header::ATX_HEADER_START, GitlabKramdown::Parser::Header::HEADER_ID, GitlabKramdown::Parser::Header::MARKDOWN_LINK_TEXT, GitlabKramdown::Parser::Header::NON_WORD_RE, GitlabKramdown::Parser::Header::SETEXT_HEADER_START
Constants included from GitlabKramdown::Parser::FencedCodeblock
GitlabKramdown::Parser::FencedCodeblock::FENCED_CODEBLOCK_MATCH, GitlabKramdown::Parser::FencedCodeblock::FENCED_CODEBLOCK_START
Constants included from GitlabKramdown::Parser::FencedBlockquote
GitlabKramdown::Parser::FencedBlockquote::FENCED_BLOCKQUOTE_MATCH, GitlabKramdown::Parser::FencedBlockquote::FENCED_BLOCKQUOTE_START
Constants included from GitlabKramdown::Parser::Escape
GitlabKramdown::Parser::Escape::ESCAPED_CHARS_GFM
Constants included from GitlabKramdown::Parser::Autolink
GitlabKramdown::Parser::Autolink::ACHARS, GitlabKramdown::Parser::Autolink::AUTOLINK_START, GitlabKramdown::Parser::Autolink::PUNCTUATION_PAIRS
Instance Method Summary collapse
-
#initialize(source, options) ⇒ GitlabKramdown
constructor
A new instance of GitlabKramdown.
Methods included from GitlabKramdown::Parser::Strikethrough
included, #parse_strikethrough_gitlab
Methods included from GitlabKramdown::Parser::Reference
#extract_reference_namespace!, included, #parse_commit, #parse_commit_diff, #parse_issue, #parse_merge_request, #parse_snippet, #parse_user_group_mention
Methods included from GitlabKramdown::Parser::Label
Methods included from GitlabKramdown::Parser::Header
#generate_header_id, included, #parse_atx_gitlab_header, #parse_setext_gitlab_header
Methods included from GitlabKramdown::Parser::FencedCodeblock
Methods included from GitlabKramdown::Parser::FencedBlockquote
included, #parse_fenced_blockquote
Methods included from GitlabKramdown::Parser::Escape
Methods included from GitlabKramdown::Parser::Autolink
included, #parse_gitlab_autolink
Constructor Details
#initialize(source, options) ⇒ GitlabKramdown
Returns a new instance of GitlabKramdown.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kramdown/parser/gitlab_kramdown.rb', line 21 def initialize(source, ) super @options[:gitlab_url] ||= 'https://gitlab.com' @options[:autolink] = false if @options[:autolink].nil? @options[:linkable_headers] = true if @options[:linkable_headers].nil? @id_counter = Hash.new(-1) prepend_span_parsers(:gitlab_autolink) if @options[:autolink] prepend_span_parsers(:escape_chars_gitlab, :commit_diff, :commit, :user_group_mention, :issue, :merge_request, :snippet, :label, :strikethrough_gitlab) prepend_block_parsers(:fenced_blockquote) replace_block_parser!(:codeblock_fenced, :codeblock_fenced_gitlab) replace_block_parser!(:atx_header, :atx_gitlab_header) replace_block_parser!(:setext_header, :setext_gitlab_header) end |