class LanguageServer::Protocol::Interface::MarkupContent

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.

Attributes

attributes[R]

Public Class Methods

new(kind:, value:) click to toggle source
# File lib/language_server/protocol/interface/markup_content.rb, line 31
def initialize(kind:, value:)
  @attributes = {}

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

  @attributes.freeze
end

Public Instance Methods

kind() click to toggle source

The type of the Markup

@return [MarkupKind]

# File lib/language_server/protocol/interface/markup_content.rb, line 44
def kind
  attributes.fetch(:kind)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/markup_content.rb, line 58
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/markup_content.rb, line 62
def to_json(*args)
  to_hash.to_json(*args)
end
value() click to toggle source

The content itself

@return [string]

# File lib/language_server/protocol/interface/markup_content.rb, line 52
def value
  attributes.fetch(:value)
end