Skip to content

html/layout: optional flush (outline) list-marker alignment#363

Open
carlos7ags wants to merge 1 commit into
mainfrom
feat/flush-list-markers
Open

html/layout: optional flush (outline) list-marker alignment#363
carlos7ags wants to merge 1 commit into
mainfrom
feat/flush-list-markers

Conversation

@carlos7ags

@carlos7ags carlos7ags commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Follow-up to #358/#360. Adds an opt-in mode that draws every nested list
marker in the container's left column (all numbers share one left edge) while
the body text still cascades per level — the "outline" style common in legal
documents — as an alternative to the per-level marker indent that is now the
default.

Comparison

Same Master Services Agreement (examples/legal-numbering), rendered both ways:

Nested (default)                 Flush (FlushListMarkers: true)
1.   Definitions.                1.   Definitions.
  1.1.  "Agreement" ...            1.1.  "Agreement" ...
  1.2.  "Services" ...             1.2.  "Services" ...
    1.2.1.  Each statement ...       1.2.1.    Each statement ...
    1.2.2.  In the event ...         1.2.2.    In the event ...
2.   Term and Termination.       2.   Term and Termination.

In nested, 1.2.1./1.2.2. indent under "Services"; in flush they stay in the
left column and the clause bodies hang. Reproduce locally by rendering the
legal-numbering example HTML with &fhtml.Options{FlushListMarkers: true}.

API

Document-wide, off by default:

doc.AddHTML(html, &fhtml.Options{FlushListMarkers: true})

Underneath, layout.List.SetMarkerFlush(bool) toggles it; sub-lists inherit
the value. Only the left-to-right outside path is affected; RTL and
list-style-position: inside are unchanged. Default (nested) output is
byte-identical.

Scope

Kept intentionally minimal: a single document-wide option, no new CSS
property. If per-<ol> control within one document is needed later, a
(non-standard) CSS property can layer on top of the same SetMarkerFlush
plumbing.

Tests

TestNestedMarkerFlush (layout: all markers share x=0 while bodies cascade) and
TestFlushListMarkersOption (the Options toggle reaches the layout and changes
the render while numbering stays intact). Full module suite passes.

@carlos7ags carlos7ags force-pushed the feat/flush-list-markers branch from 58b1098 to ce8a2d8 Compare June 9, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants