Method: Brief::Document::Structure#heading_elements

Defined in:
lib/brief/document/structure.rb

#heading_elementsObject



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/brief/document/structure.rb', line 138

def heading_elements
  @heading_elements ||= fragment.css('h1,h2,h3,h4,h5,h6').map do |el|
    if el.attr('data-level').to_i > 0
      {
        level: el.attr('data-level'),
        heading: el.attr('data-heading'),
        element: el
      }.to_mash
    end
  end.compact
end