Module: Banzai

Defined in:
lib/banzai/filter/math_filter.rb,
lib/banzai.rb,
lib/banzai/filter.rb,
lib/banzai/pipeline.rb,
lib/banzai/querying.rb,
lib/banzai/renderer.rb,
lib/banzai/color_parser.rb,
lib/banzai/filter_array.rb,
lib/banzai/render_context.rb,
lib/banzai/commit_renderer.rb,
lib/banzai/object_renderer.rb,
lib/banzai/reference_parser.rb,
lib/banzai/issuable_extractor.rb,
lib/banzai/reference_redactor.rb,
lib/banzai/filter/color_filter.rb,
lib/banzai/filter/emoji_filter.rb,
lib/banzai/reference_extractor.rb,
lib/banzai/filter/output_safety.rb,
lib/banzai/filter/mermaid_filter.rb,
lib/banzai/pipeline/gfm_pipeline.rb,
lib/banzai/filter/autolink_filter.rb,
lib/banzai/filter/footnote_filter.rb,
lib/banzai/filter/markdown_filter.rb,
lib/banzai/filter/plantuml_filter.rb,
lib/banzai/pipeline/atom_pipeline.rb,
lib/banzai/pipeline/base_pipeline.rb,
lib/banzai/pipeline/full_pipeline.rb,
lib/banzai/pipeline/note_pipeline.rb,
lib/banzai/pipeline/wiki_pipeline.rb,
lib/banzai/cross_project_reference.rb,
lib/banzai/filter/reference_filter.rb,
lib/banzai/filter/task_list_filter.rb,
lib/banzai/filter/wiki_link_filter.rb,
lib/banzai/pipeline/email_pipeline.rb,
lib/banzai/pipeline/emoji_pipeline.rb,
lib/banzai/pipeline/label_pipeline.rb,
lib/banzai/filter/audio_link_filter.rb,
lib/banzai/filter/image_link_filter.rb,
lib/banzai/filter/suggestion_filter.rb,
lib/banzai/filter/video_link_filter.rb,
lib/banzai/pipeline/markup_pipeline.rb,
lib/banzai/filter/asset_proxy_filter.rb,
lib/banzai/filter/gollum_tags_filter.rb,
lib/banzai/filter/html_entity_filter.rb,
lib/banzai/filter/inline_diff_filter.rb,
lib/banzai/filter/spaced_link_filter.rb,
lib/banzai/filter/upload_link_filter.rb,
lib/banzai/renderer/common_mark/html.rb,
lib/banzai/filter/front_matter_filter.rb,
lib/banzai/filter/sanitization_filter.rb,
lib/banzai/pipeline/combined_pipeline.rb,
lib/banzai/filter/absolute_link_filter.rb,
lib/banzai/filter/external_link_filter.rb,
lib/banzai/filter/inline_embeds_filter.rb,
lib/banzai/filter/playable_link_filter.rb,
lib/banzai/filter/set_direction_filter.rb,
lib/banzai/pipeline/ascii_doc_pipeline.rb,
lib/banzai/filter/epic_reference_filter.rb,
lib/banzai/filter/inline_metrics_filter.rb,
lib/banzai/filter/issuable_state_filter.rb,
lib/banzai/filter/user_reference_filter.rb,
lib/banzai/reference_parser/base_parser.rb,
lib/banzai/reference_parser/epic_parser.rb,
lib/banzai/reference_parser/user_parser.rb,
lib/banzai/filter/commit_trailers_filter.rb,
lib/banzai/filter/image_lazy_load_filter.rb,
lib/banzai/filter/issue_reference_filter.rb,
lib/banzai/filter/label_reference_filter.rb,
lib/banzai/filter/repository_link_filter.rb,
lib/banzai/pipeline/description_pipeline.rb,
lib/banzai/pipeline/pre_process_pipeline.rb,
lib/banzai/pipeline/single_line_pipeline.rb,
lib/banzai/reference_parser/issue_parser.rb,
lib/banzai/reference_parser/label_parser.rb,
lib/banzai/request_store_reference_cache.rb,
lib/banzai/filter/blockquote_fence_filter.rb,
lib/banzai/filter/commit_reference_filter.rb,
lib/banzai/filter/design_reference_filter.rb,
lib/banzai/filter/syntax_highlight_filter.rb,
lib/banzai/pipeline/post_process_pipeline.rb,
lib/banzai/reference_parser/commit_parser.rb,
lib/banzai/reference_parser/design_parser.rb,
lib/banzai/filter/base_sanitization_filter.rb,
lib/banzai/filter/project_reference_filter.rb,
lib/banzai/filter/snippet_reference_filter.rb,
lib/banzai/filter/table_of_contents_filter.rb,
lib/banzai/reference_parser/project_parser.rb,
lib/banzai/reference_parser/snippet_parser.rb,
lib/banzai/filter/abstract_reference_filter.rb,
lib/banzai/filter/base_relative_link_filter.rb,
lib/banzai/filter/issuable_reference_filter.rb,
lib/banzai/filter/reference_redactor_filter.rb,
lib/banzai/filter/wiki_link_filter/rewriter.rb,
lib/banzai/pipeline/plain_markdown_pipeline.rb,
lib/banzai/reference_parser/issuable_parser.rb,
lib/banzai/filter/iteration_reference_filter.rb,
lib/banzai/filter/milestone_reference_filter.rb,
lib/banzai/reference_parser/iteration_parser.rb,
lib/banzai/reference_parser/milestone_parser.rb,
lib/banzai/filter/inline_alert_metrics_filter.rb,
lib/banzai/filter/markdown_engines/common_mark.rb,
lib/banzai/filter/table_of_contents_tag_filter.rb,
lib/banzai/pipeline/broadcast_message_pipeline.rb,
lib/banzai/filter/ascii_doc_sanitization_filter.rb,
lib/banzai/filter/commit_range_reference_filter.rb,
lib/banzai/filter/inline_cluster_metrics_filter.rb,
lib/banzai/filter/inline_grafana_metrics_filter.rb,
lib/banzai/pipeline/commit_description_pipeline.rb,
lib/banzai/reference_parser/commit_range_parser.rb,
lib/banzai/filter/inline_metrics_redactor_filter.rb,
lib/banzai/filter/merge_request_reference_filter.rb,
lib/banzai/reference_parser/merge_request_parser.rb,
lib/banzai/filter/external_issue_reference_filter.rb,
lib/banzai/reference_parser/external_issue_parser.rb,
lib/banzai/reference_parser/mentioned_user_parser.rb,
lib/banzai/filter/ascii_doc_post_processing_filter.rb,
lib/banzai/reference_parser/mentioned_group_parser.rb,
lib/banzai/reference_parser/mentioned_project_parser.rb,
lib/banzai/filter/jira_import/adf_to_commonmark_filter.rb,
lib/banzai/filter/broadcast_message_placeholders_filter.rb,
lib/banzai/filter/broadcast_message_sanitization_filter.rb,
lib/banzai/pipeline/jira_import/adf_commonmark_pipeline.rb,
lib/banzai/reference_parser/directly_addressed_user_parser.rb

Overview

`CommonMark` markdown engine for GitLab's Banzai markdown filter. This module is used in Banzai::Filter::MarkdownFilter. Used gem is `commonmarker` which is a ruby wrapper for libcmark (CommonMark parser) including GitHub's GFM extensions. Homepage: github.com/gjtorikian/commonmarker

Defined Under Namespace

Modules: ColorParser, CommitRenderer, CrossProjectReference, Filter, Pipeline, Querying, ReferenceParser, Renderer, RequestStoreReferenceCache Classes: FilterArray, IssuableExtractor, ObjectRenderer, ReferenceExtractor, ReferenceRedactor, RenderContext

Class Method Summary collapse

Class Method Details

.cache_collection_render(texts_and_contexts) ⇒ Object


23
24
25
# File 'lib/banzai.rb', line 23

def self.cache_collection_render(texts_and_contexts)
  Renderer.cache_collection_render(texts_and_contexts)
end

.post_process(html, context) ⇒ Object


31
32
33
# File 'lib/banzai.rb', line 31

def self.post_process(html, context)
  Renderer.post_process(html, context)
end

.render(text, context = {}) ⇒ Object


15
16
17
# File 'lib/banzai.rb', line 15

def self.render(text, context = {})
  Renderer.render(text, context)
end

.render_and_post_process(text, context = {}) ⇒ Object

if you need to render markdown, then you probably need to post_process as well, such as removing references that the current user doesn't have permission to make


7
8
9
# File 'lib/banzai.rb', line 7

def self.render_and_post_process(text, context = {})
  post_process(render(text, context), context)
end

.render_field(object, field, context = {}) ⇒ Object


19
20
21
# File 'lib/banzai.rb', line 19

def self.render_field(object, field, context = {})
  Renderer.render_field(object, field, context)
end

.render_field_and_post_process(object, field, context = {}) ⇒ Object


11
12
13
# File 'lib/banzai.rb', line 11

def self.render_field_and_post_process(object, field, context = {})
  post_process(render_field(object, field, context), context)
end

.render_result(text, context = {}) ⇒ Object


27
28
29
# File 'lib/banzai.rb', line 27

def self.render_result(text, context = {})
  Renderer.render_result(text, context)
end