Module: TreeHaver::Backends::Markly
- Defined in:
- lib/tree_haver/backends/markly.rb
Overview
Note:
This backend only parses Markdown source code
Markly backend using the Markly gem (cmark-gfm C library)
This backend wraps Markly, a Ruby gem that provides bindings to cmark-gfm, GitHub’s fork of the CommonMark C library with extensions.
Defined Under Namespace
Classes: Language, Node, Parser, Point, Tree
Class Method Summary collapse
- .available? ⇒ Boolean
-
.capabilities ⇒ Hash{Symbol => Object}
Get capabilities supported by this backend.
-
.reset! ⇒ void
private
Reset the load state (primarily for testing).
Class Method Details
.available? ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tree_haver/backends/markly.rb', line 30 def available? return @loaded if @load_attempted @load_attempted = true begin require "markly" @loaded = true rescue LoadError @loaded = false end @loaded end |
.capabilities ⇒ Hash{Symbol => Object}
Get capabilities supported by this backend
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/tree_haver/backends/markly.rb', line 54 def capabilities return {} unless available? { backend: :markly, query: false, bytes_field: false, # Markly uses line/column incremental: false, pure_ruby: false, # Uses C via FFI markdown_only: true, error_tolerant: true, # Markdown is forgiving gfm_extensions: true, # Supports GitHub Flavored Markdown } end |
.reset! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Reset the load state (primarily for testing)
46 47 48 49 |
# File 'lib/tree_haver/backends/markly.rb', line 46 def reset! @load_attempted = false @loaded = false end |