Module: Solargraph::Pin::Documenting

Included in:
Base
Defined in:
lib/solargraph/pin/documenting.rb

Overview

A module to add the Pin::Base#documentation method.

Instance Method Summary collapse

Instance Method Details

#documentationString


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/solargraph/pin/documenting.rb', line 11

def documentation
  @documentation ||= begin
    html = Kramdown::Document.new(
      normalize_indentation(docstring.to_s),
      input: 'GFM',
      entity_output: :symbolic,
      syntax_highlighter: nil
    ).to_html
    ReverseMarkdown.convert(html, github_flavored: true).lines.map(&:rstrip).join("\n")
  end
end