         mapping[id] = num
         num += 1
       child.footnoteNumber = mapping[id]
-    defineFootnoteNumber(child, num, mapping)
-  mapping
+    if child.children
+      num = defineFootnoteNumber(child, num, mapping).maxNumber
+  {mapping, maxNumber: num}
 
 # Sets `footnoteNumber` property to every footnote definition node using a
 # given identifier-to-number mapping. `footnoteNumber` of a definition with


  # Process footnotes and and links.
  if options.footnotes
    mapping = defineFootnoteNumber(root)
    applyFootnoteNumber(root, mapping)
  defs = removeDefinitions(root)
  if options.footnotes


# Sets `footnoteNumber` property to every footnote reference node.
# Footnote number starts at 1 and is incremented whenever a new footnote
# identifier appears. Returns `{mapping, maxNumber}`
#
# Example (Markdown):
#
