@@ -191,13 +191,16 @@ func handleElement(ctx *Context) {
191191
192192 if hasPChild { // handle potential additional <p> blocks that should be indented
193193 cnode := ctx .Node
194+ orignode := cnode
194195 // ctx.BlockParent = text.Parent.(core.Widget)
196+ got := false
195197 for cnode .NextSibling != nil {
196198 cnode = cnode .NextSibling
197- ctx .Node = cnode
198199 if cnode .Data != "p" {
199- continue
200+ break
200201 }
202+ ctx .Node = cnode
203+ got = true
201204 txt , psub := handleTextExclude (ctx , "ol" , "ul" )
202205 txt .SetText (txt .Text )
203206 ctx .handleWidget (cnode , txt )
@@ -208,6 +211,9 @@ func handleElement(ctx *Context) {
208211 break
209212 }
210213 }
214+ if ! got && cnode != nil && cnode != orignode {
215+ readHTMLNode (ctx , ctx .Parent (), cnode )
216+ }
211217 }
212218 if sublist != nil {
213219 readHTMLNode (ctx , ctx .Parent (), sublist )
@@ -403,7 +409,8 @@ func handleTextExclude(ctx *Context, excludeSubs ...string) (*core.Text, *html.N
403409 return core .NewText (), excl
404410 }
405411 tx := New [core.Text ](ctx ).SetText (et )
406- if strings .Contains (et , "\n " ) && ! strings .Contains (et , "math display" ) {
412+ tag := ctx .Node .Data
413+ if tag != "li" && strings .Contains (et , "\n " ) && ! strings .Contains (et , `<span class="math display">` ) {
407414 tx .Styler (func (s * styles.Style ) {
408415 s .Text .WhiteSpace = text .WhiteSpacePreWrap
409416 })
0 commit comments