Skip to content

docs: surface headingId (and bookmark/named-range anchors) in headings/paragraphs output for deep-linking #819

@sebsnyk

Description

@sebsnyk

Problem

The Google Docs API exposes each heading paragraph's auto-generated anchor id at paragraph.paragraphStyle.headingId — this is exactly what ...#heading=h.xxxx deep links resolve to. But gog docs headings list and gog docs paragraphs list (both -p and --json) omit it. Without it there is no way to build a deep link to a specific heading from gog output alone; you have to drop down to a raw Docs API client (documents.get(includeTabsContent=true)) just to read a field gog already has in hand.

Request

Surface headingId in:

  • gog docs headings list — per-heading object (at minimum in --json)
  • gog docs paragraphs list — per-paragraph object, when the paragraph carries one

Adjacent (same deep-linking use case)

The same "I have the element but cannot link to it" gap applies to the other anchorable targets the API already returns. Worth covering in one pass:

  • bookmark ids (bookmark / bookmarkId on a paragraph or text run) — for #bookmark=id links
  • named ranges (document.namedRanges)

Surfacing these lets a caller build any in-document deep link without a second API client.

Repro

gog docs headings list <docId> --json
# each heading object has index/start/end/style/text but no headingId

Version

gog 0.27.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions