Thanks. Any pointers to lua filters that do something similar?
Looks feasible. Pandoc converts the first html to:[ BulletList
[ [ Plain
[ ... Inlines ]
]
, [ BulletList
[ [ Plain
[ ... Inlines ]
]
, [ Plain
[ ... Inlines ]
]
]
]
, [ Plain
[ Inlines ]
]
]
]I.e., the sublist is converted to its own list item. So the filter should pick up list, check if any item within them consists of a lone sublist, and if so, move it to the previous item. (And best, apply the filter recursively to that sublist itself.)On Saturday, February 25, 2023 at 2:26:04 PM UTC JDTS wrote:The Apple Notes app produces (via AppleScript) HTML for notes with nested lists structured like:<ul>
<li>Level 1 element 1</li>
<ul>
<li>Level 2 element 1</li>
<li>Level 2 element 2</li>
</ul>
<li>Level 1 element 2</li>
</ul>
As you can see, the sublist is incorrectly positioned. It should be positioned within the <li> Level 1 element 1 item, ala:<ul>
<li>Level 1 element 1
<ul>
<li>Level 2 element 1</li>
<li>Level 2 element 2</li>
</ul>
</li>
<li>Level 1 element 2</li>
</ul>
Is there a straightforward way with Lua filters to fix this at the AST level, for arbitrary-depth sublist nesting?