class AlgoliaHTMLExtractor

def extract_anchor(node)

Foo

=> anchor

Foo

=> anchor

Foo

=> anchor
eg.

Returns the anchor to the node
def extract_anchor(node)
  anchor = node.attr('name') || node.attr('id') || nil
  return anchor unless anchor.nil?
  # No anchor found directly in the header, search on children
  subelement = node.css('[name],[id]')
  return extract_anchor(subelement[0]) unless subelement.empty?
  nil
end