Skip to main content
2 of 3
added 10 characters in body
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 53 52 bytes

VŻ;0Iµ>0ị“<ol>“</ol>”ẋA) Ḋœṡ¥€⁶ZḢÇżṪ“<li>“</li>”jⱮƊƲ 

Try it online!

A full program taking a list of strings as input and outputting an HTML fragment with nested ordered lists. Should handle arbitrarily deep nesting of lists.

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 
  1. All About Birds
    1. Kinds of Birds
      1. The Finch
      2. The Swan
    2. Habitats
      1. Wetlands
        1. Types of wetlands
          1. Very wet wetland
      2. Coast
  2. All about fish
    1. Sharks
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44