Class: AsciiDocConverter::AsciiDoc

Inherits:
Bridgetown::Converter
  • Object
show all
Defined in:
lib/asciidoc_converter/asciidoc.rb

Instance Method Summary collapse

Instance Method Details

#convert(content, convertible = nil) ⇒ Object

The conversion pipeline handoff



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/asciidoc_converter/asciidoc.rb', line 19

def convert(content, convertible = nil)
  # Setup modern rendering options matching your workspace style
  options = {
    safe: :safe,
    attributes: {
      "icons" => "font",
      "sectanchors" => true,
      "source-highlighter" => "rouge", # Integrates with Bridgetown's default highlighters
      "imagesdir" => "/images@" # trailing @ makes this a soft default, overridable by an in-document :imagesdir:
    }
  }

  # Render the AsciiDoc content string to safe HTML5
  Asciidoctor.convert(content, options)
end

#matches(ext, _convertible = nil) ⇒ Object

Tell Bridgetown to process these source extensions



9
10
11
# File 'lib/asciidoc_converter/asciidoc.rb', line 9

def matches(ext, _convertible = nil)
  ext =~ /^\.(adoc|asciidoc)$/i
end

#output_ext(ext) ⇒ Object

Output everything into static HTML files



14
15
16
# File 'lib/asciidoc_converter/asciidoc.rb', line 14

def output_ext(ext)
  ".html"
end