Skip to content

docs find-replace --format markdown leaks inline / block markdown as literal text (italic, bold, blockquote, fenced code) #586

@sebsnyk

Description

@sebsnyk

Summary

gog docs find-replace <docId> <find> <replace> --format markdown (and --content-file) successfully renders block-level structure but leaks inline / block formatting as literal markdown characters. The fix in #494 wired up the rendering path, but the converter itself doesn't handle several common markdown constructs.

What works

  • ATX headings (#, ##, ###) → HEADING_1 / HEADING_2 / HEADING_3
  • Bullet lists (- item)
  • Pipe tables → TABLE element

What leaks as literal text

  • Italic _text_ → underscores remain visible
  • Bold **text** inside paragraphs → asterisks remain visible
  • Blockquote > text> lands as a literal character on its own line (breaks the callout)
  • Fenced code blocks (```lang … ```) → flat plain paragraphs, no monospace, no grey background
  • Inline emphasis combinations (e.g. **bold _and italic_**)

Repro (v0.16.0, macOS arm64)

    cat > /tmp/repro.md <<'EOF'
    ## Heading works
    
    This has **bold** and _italic_ and a `code span`.
    
    > blockquote should be a callout
    
    ```python
    print("hello")
    ```
    EOF
    
    DOC=$(gog docs create "gogcli md repro" --json | jq -r .id)
    gog docs write "$DOC" --text "REPLACE_ME"
    gog docs find-replace "$DOC" "REPLACE_ME" --content-file /tmp/repro.md --format markdown
    gog docs cat "$DOC"

Observed on a 30-page document today: 1 H1, 5 H2, 23 H3, 1 table all correct; every **…**, _…_, > …, and fenced code block leaked as raw markdown.

Expected

Match the fidelity of pasting the same .md into Google Docs UI via Edit > Paste from Markdown (which renders all of the above correctly).

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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