Method: MarkdownLint::Doc#list_style

Defined in:
lib/mdl/doc.rb

#list_style(item) ⇒ Object

Returns the list style for a list: :asterisk, :plus, :dash, :ordered or :ordered_paren depending on which symbol is used to denote the list item. You can pass in either the element itself or an options hash here.



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/mdl/doc.rb', line 189

def list_style(item)
  if item.type != :li
    raise "list_style called with non-list element"
  end
  line = element_line(item).strip
  if line.start_with?('*')
    :asterisk
  elsif line.start_with?('+')
    :plus
  elsif line.start_with?('-')
    :dash
  elsif line.match('[0-9]+\.')
    :ordered
  elsif line.match('[0-9]+\)')
    :ordered_paren
  else
    :unknown
  end
end