Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions htmlcore/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,16 @@ func handleElement(ctx *Context) {

if hasPChild { // handle potential additional <p> blocks that should be indented
cnode := ctx.Node
orignode := cnode
// ctx.BlockParent = text.Parent.(core.Widget)
got := false
for cnode.NextSibling != nil {
cnode = cnode.NextSibling
ctx.Node = cnode
if cnode.Data != "p" {
continue
break
}
ctx.Node = cnode
got = true
txt, psub := handleTextExclude(ctx, "ol", "ul")
txt.SetText(txt.Text)
ctx.handleWidget(cnode, txt)
Expand All @@ -208,6 +211,9 @@ func handleElement(ctx *Context) {
break
}
}
if !got && cnode != nil && cnode != orignode {
readHTMLNode(ctx, ctx.Parent(), cnode)
}
}
if sublist != nil {
readHTMLNode(ctx, ctx.Parent(), sublist)
Expand Down Expand Up @@ -403,7 +409,8 @@ func handleTextExclude(ctx *Context, excludeSubs ...string) (*core.Text, *html.N
return core.NewText(), excl
}
tx := New[core.Text](ctx).SetText(et)
if strings.Contains(et, "\n") && !strings.Contains(et, "math display") {
tag := ctx.Node.Data
if tag != "li" && strings.Contains(et, "\n") && !strings.Contains(et, `<span class="math display">`) {
tx.Styler(func(s *styles.Style) {
s.Text.WhiteSpace = text.WhiteSpacePreWrap
})
Expand Down
2 changes: 2 additions & 0 deletions yaegicore/coresymbols/cogentcore_org-core-core.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.