Method: MarkdownLint::Doc#header_style

Defined in:
lib/mdl/doc.rb

#header_style(header) ⇒ Object

Returns the header ‘style’ - :atx (hashes at the beginning), :atx_closed (atx header style, but with hashes at the end of the line also), :setext (underlined). You can pass in the element object or an options hash here.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/mdl/doc.rb', line 168

def header_style(header)
  if header.type != :header
    raise "header_style called with non-header element"
  end
  line = element_line(header)
  if line.start_with?("#")
    if line.strip.end_with?("#")
      :atx_closed
    else
      :atx
    end
  else
    :setext
  end
end