Sha256: 9701fff2e32ac9f8eae266d49cf1174a18e0488d51e53305f38d376751664624
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 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. # See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting # # Here is an example how such a string can be constructed using JavaScript / TypeScript: # ```ts # 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
language_server-protocol-3.12.0.0 | lib/language_server/protocol/interface/markup_content.rb |
language_server-protocol-3.7.0.0 | lib/language_server/protocol/interface/markup_content.rb |