Module: Govspeak::KramdownOverrides

Defined in:
lib/govspeak/kramdown_overrides.rb

Class Method Summary collapse

Class Method Details

.with_kramdown_ordered_lists_disabledObject

 This depends on two internal parts of Kramdown.

  1. Parser registry (kramdown/parser/kramdown.rb#define_parser)

  2. Kramdown list regexes (kramdown/parser/kramdown/list.rb)

 Updating the Kramdown gem therefore also means updating this file to to match Kramdown’s internals.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/govspeak/kramdown_overrides.rb', line 9

def self.with_kramdown_ordered_lists_disabled
  original_list_start = list_start 
  redefine_kramdown_const(:LIST_START, list_start_ul)
  list_parser = kramdown_parsers.delete(:list)
  Kramdown::Parser::Kramdown.define_parser(:list, list_start_ul)

  yield
ensure
  redefine_kramdown_const(:LIST_START, original_list_start)
  kramdown_parsers[:list] = list_parser
end