Class: Commonmarker::Merge::FileAnalysis

Inherits:
Markdown::Merge::FileAnalysis
  • Object
show all
Defined in:
lib/commonmarker/merge/file_analysis.rb

Overview

File analysis for Markdown files using CommonMarker.

This is a thin wrapper around Markdown::Merge::FileAnalysis that:

  • Forces the :commonmarker backend
  • Sets the default freeze token to “commonmarker-merge”
  • Exposes commonmarker-specific options

Examples:

Basic usage

analysis = FileAnalysis.new(markdown_source)
analysis.statements.each do |node|
  puts "#{node.merge_type}: #{node.type}"
end

With custom freeze token

analysis = FileAnalysis.new(source, freeze_token: "my-merge")

See Also:

  • Underlying implementation

Constant Summary collapse

DEFAULT_FREEZE_TOKEN =

Default freeze token for commonmarker-merge

Returns:

  • (String)
"commonmarker-merge"

Instance Method Summary collapse

Constructor Details

#initialize(source, freeze_token: DEFAULT_FREEZE_TOKEN, signature_generator: nil, options: {}) ⇒ FileAnalysis

Initialize file analysis with CommonMarker backend.

Parameters:

  • source (String)

    Markdown source code to analyze

  • freeze_token (String) (defaults to: DEFAULT_FREEZE_TOKEN)

    Token for freeze block markers (default: “commonmarker-merge”)

  • signature_generator (Proc, nil) (defaults to: nil)

    Custom signature generator

  • options (Hash) (defaults to: {})

    CommonMarker parse options



33
34
35
36
37
38
39
40
41
# File 'lib/commonmarker/merge/file_analysis.rb', line 33

def initialize(source, freeze_token: DEFAULT_FREEZE_TOKEN, signature_generator: nil, options: {})
  super(
    source,
    backend: :commonmarker,
    freeze_token: freeze_token,
    signature_generator: signature_generator,
    options: options,
  )
end

Instance Method Details

#freeze_node_classClass

Returns the FreezeNode class to use.

Returns:

  • (Class)

    Commonmarker::Merge::FreezeNode



46
47
48
# File 'lib/commonmarker/merge/file_analysis.rb', line 46

def freeze_node_class
  FreezeNode
end