I have been using gog docs format for surgical paragraph styling and hit a wall: it covers --named-style, --alignment, --line-spacing, and run-level text styling, but cannot turn an existing paragraph into a list, demote a list back to plain text, or adjust indentation/spacing. Today the only way to get a bullet or change an indent is to re-render the surrounding region via the markdown writer (write/find-replace --format markdown), which rewrites the whole paragraph and is the single most common reason a surgical edit becomes a region rewrite.
The Docs API has the primitives already; they are just not surfaced:
createParagraphBullets (with a bulletPreset, e.g. BULLET_DISC_CIRCLE_SQUARE or NUMBERED_DECIMAL_ALPHA_ROMAN) — make a paragraph range a bulleted/numbered list.
deleteParagraphBullets — demote a list range back to plain paragraphs.
updateParagraphStyle fields not currently exposed: indentStart, indentFirstLine, indentEnd, spaceAbove, spaceBelow, keepWithNext, keepLinesTogether.
The format command already builds an UpdateParagraphStyleRequest, so the spacing/indent fields are a small extension to the existing fieldmask. The bullets case needs two new request builders.
Proposed flags on docs format:
--bullets[=PRESET] # createParagraphBullets; default BULLET_DISC_CIRCLE_SQUARE
--ordered[=PRESET] # createParagraphBullets with a NUMBERED_* preset
--no-bullets # deleteParagraphBullets
--indent-start=PT --indent-first-line=PT --indent-end=PT
--space-above=PT --space-below=PT
--keep-with-next / --no-keep-with-next
These would compose with the existing --match / --match-all anchoring the same way the text-style flags do. This closes the largest remaining whole-region-rewrite trigger for paragraph editing.
Ref: documents.batchUpdate Request reference (createParagraphBullets, deleteParagraphBullets, updateParagraphStyle).
I have been using
gog docs formatfor surgical paragraph styling and hit a wall: it covers--named-style,--alignment,--line-spacing, and run-level text styling, but cannot turn an existing paragraph into a list, demote a list back to plain text, or adjust indentation/spacing. Today the only way to get a bullet or change an indent is to re-render the surrounding region via the markdown writer (write/find-replace --format markdown), which rewrites the whole paragraph and is the single most common reason a surgical edit becomes a region rewrite.The Docs API has the primitives already; they are just not surfaced:
createParagraphBullets(with abulletPreset, e.g.BULLET_DISC_CIRCLE_SQUAREorNUMBERED_DECIMAL_ALPHA_ROMAN) — make a paragraph range a bulleted/numbered list.deleteParagraphBullets— demote a list range back to plain paragraphs.updateParagraphStylefields not currently exposed:indentStart,indentFirstLine,indentEnd,spaceAbove,spaceBelow,keepWithNext,keepLinesTogether.The
formatcommand already builds anUpdateParagraphStyleRequest, so the spacing/indent fields are a small extension to the existing fieldmask. The bullets case needs two new request builders.Proposed flags on
docs format:These would compose with the existing
--match/--match-allanchoring the same way the text-style flags do. This closes the largest remaining whole-region-rewrite trigger for paragraph editing.Ref: documents.batchUpdate Request reference (createParagraphBullets, deleteParagraphBullets, updateParagraphStyle).