Skip to content

docs write --replace --markdown should support --tab (whole-tab re-render) #595

Description

@sebsnyk

What

gog docs write <docId> --tab=<tab> --file=<md> --markdown --replace is rejected with:

--markdown with --replace does not support --tab (Drive's markdown converter operates on entire documents)

The whole-document-only limitation is in Drive's markdown converter, not the Docs API. The Docs API itself can target tab ranges via documents.batchUpdate (insertText / deleteContentRange with the tab's content boundaries). gog could convert MD locally (or via the existing markdown path) and apply the result against the specific tab range, achieving whole-tab re-render without touching other tabs.

Why

Once a doc has multiple tabs, every meaningful update is per-tab. Today the options for updating a tab's contents are:

  1. --append --markdown --tab — partially broken (docs write --markdown --append fails to insert tables: 'insert native table: table not found near index N' #592 tables, docs write --markdown --append emits literal bullets + per-line code paragraphs (no native list, no contiguous code block) #594 bullets + fenced code as literals).
  2. find-replace --format=markdown --tab — surgical but doesn't help when the whole tab needs to change shape (re-ordered sections, replaced lists).
  3. Manual paste — requires a human at the keyboard.

A clean whole-tab re-render is the natural primitive when the source-of-truth markdown changes; without it, agent-driven Doc workflows have to chain many surgical find-replaces and hope the existing tab text still matches.

Suggested behaviour

gog docs write <docId> --tab='Gold list' --file=gold.md --markdown --replace
# Replaces only the Gold list tab content with the markdown-rendered version of gold.md.
# Other tabs untouched.

Scope

  • Whole-tab content replacement only (don't need section-level replace).
  • Should produce the same paragraph/list/code/table fidelity as docs create --file --markdown (the converter path that already works correctly).
  • Tab properties (title, parent, index) stay unchanged.

Context

Filed alongside #592 (tables in --append), #594 (bullets + code in --append), and #593 (pageless flag). Together these define the agent-side gaps for updating tabbed docs cleanly without paste.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions