Skip to content

docs: close the doc.struct() calls in the structParent accessibility example - #1860

Merged
liborm85 merged 1 commit into
foliojs:masterfrom
fstandhartinger:docs-accessibility-struct-paren
Nov 3, 2026
Merged

liborm85 merged 1 commit into
foliojs:masterfrom
fstandhartinger:docs-accessibility-struct-paren

Conversation

@fstandhartinger

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Docs fix. In docs/accessibility.md, the "This is equivalent to:" example after the structParent text example has an unbalanced parenthesis on both lines:

section.add(doc.struct('P', () => { doc.text("Foo. "); });   // SyntaxError: missing ) after argument list

The doc.struct(...) call is never closed. This PR adds the missing ) to both lines.

I checked it against current master (built with rollup -c):

  • With the fix, the snippet runs. It produces the same structure tree as the structParent version above it: Sect → P, P with MCIDs 0 and 1. So the "equivalent" claim holds once the syntax is correct.
  • I syntax-checked all 98 indented code blocks in docs/*.md. This was the only real syntax error. The other hits were top-level await in the ES-module examples, which is valid, and the cell-style object in table.md, which is shown as data.

Checklist:

One note: node docs/generate_website.js stops on unmodified master too, at a forms.md example (Call document.initForm() method before adding form elements to document). It is unrelated to this change, and I didn't touch it here.

Disclosure: I build a hosted document-generation API. Nothing of it is linked or relevant here. I found this while running the docs examples, with help from an AI assistant (Claude Code), and I checked the result myself.

The two section.add(doc.struct('P', () => { ... }); lines in the
accessibility guide are missing a closing parenthesis, so the example
throws a SyntaxError when pasted.
@liborm85
liborm85 merged commit 14ae33e into foliojs:master Nov 3, 2026
3 checks passed
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