Sha256: 479005cad957cefe57f634752c1af9b677c70903687f4006116ed6dddc382098

Contents?: true

Size: 1.59 KB

Versions: 106

Compression:

Stored size: 1.59 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # A `MarkupContent` literal represents a string value which content is
      # interpreted base on its kind flag. Currently the protocol supports
      # `plaintext` and `markdown` as markup kinds.
      #
      # If the kind is `markdown` then the value can contain fenced code blocks like
      # in GitHub issues.
      #
      # Here is an example how such a string can be constructed using
      # JavaScript / TypeScript:
      # ```typescript
      # let markdown: MarkdownContent = {
      # kind: MarkupKind.Markdown,
      # value: [
      # '# Header',
      # 'Some text',
      # '```typescript',
      # 'someCode();',
      # '```'
      # ].join('\n')
      # };
      # ```
      #
      # *Please Note* that clients might sanitize the return markdown. A client could
      # decide to remove HTML from the markdown to avoid script execution.
      #
      class MarkupContent
        def initialize(kind:, value:)
          @attributes = {}

          @attributes[:kind] = kind
          @attributes[:value] = value

          @attributes.freeze
        end

        #
        # The type of the Markup
        #
        # @return [MarkupKind]
        def kind
          attributes.fetch(:kind)
        end

        #
        # The content itself
        #
        # @return [string]
        def value
          attributes.fetch(:value)
        end

        attr_reader :attributes

        def to_hash
          attributes
        end

        def to_json(*args)
          to_hash.to_json(*args)
        end
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 12 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.4 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.3 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.2 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.1 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
study_line-0.2.0 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.10 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.9 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.8 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.7 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.6 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.5 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb
harbr-0.2.4 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/markup_content.rb