Sha256: 30f118653f8ef45fe887e062b019353e60a087907212f9fd1ab2140f7185a2d3

Contents?: true

Size: 844 Bytes

Versions: 108

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Beta
    # Use `Markdown` to wrap markdown content.
    class Markdown < Primer::Component
      status :beta

      DEFAULT_TAG = :div
      TAG_OPTIONS = [DEFAULT_TAG, :article, :td].freeze

      # @param tag [Symbol] <%= one_of(Primer::Beta::Markdown::TAG_OPTIONS) %>
      # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
      def initialize(tag: DEFAULT_TAG, **system_arguments)
        @system_arguments = system_arguments
        @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)

        @system_arguments[:classes] = class_names(
          "markdown-body",
          system_arguments[:classes]
        )
      end

      def call
        render(Primer::BaseComponent.new(**@system_arguments)) { content }
      end
    end
  end
end

Version data entries

108 entries across 108 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.49.2 app/components/primer/beta/markdown.rb
primer_view_components-0.35.2 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.49.1 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.49.0 app/components/primer/beta/markdown.rb
primer_view_components-0.35.1 app/components/primer/beta/markdown.rb
primer_view_components-0.35.0 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.48.2 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.48.1 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.48.0 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.47.1 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.47.0 app/components/primer/beta/markdown.rb
primer_view_components-0.34.0 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.46.1 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.46.0 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.45.0 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.44.3 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.44.2 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.44.1 app/components/primer/beta/markdown.rb
primer_view_components-0.33.0 app/components/primer/beta/markdown.rb
openproject-primer_view_components-0.44.0 app/components/primer/beta/markdown.rb