Jelly, 53 5250 bytes
VŻ;0Iµ>0ị“<ol>“<Ḋœṡ¥€⁶ZµḢVØ0jI>0ẋ"AƲị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪ“<li>“<ol>”żṪ“<li>“</li>”jⱮƊƲli>”jⱮƊ A full programmonadic link taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists and return a syntactically valid HTML fragment.
Example:
H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 Wetlands H4 Types of wetlands H5 Very wet wetland H3 Coast H1 All about fish H2 Sharks yields:
<ol><li>All About Birds</li><ol><li>Kinds of Birds</li><ol><li>The Finch</li><li>The Swan</li></ol><li>Habitats</li><ol><li>Wetlands</li><ol><li>Types of wetlands</li><ol><li>Very wet wetland</li></ol></ol><li>Coast</li></ol></ol><li>All about fish</li><ol><li>Sharks</li></ol></ol> - All About Birds
- Kinds of Birds
- The Finch
- The Swan
- Habitats
- Wetlands
- Types of wetlands
- Very wet wetland
- Coast
- All about fish
- Sharks