feat(block): add GFM table and inline formatting support#10
Merged
Conversation
- parseMarkdownToBlocks(): detect pipe-delimited tables, build Notion table/table_row block structure (table_width, has_column_header) - parseInlineFormatting(): tokenize **bold**, *italic*, _italic_, \`code\`, ~~strike~~, [link](url) → rich_text annotations array - makeTextBlock(): now uses parseInlineFormatting instead of plain text - renderBlockMarkdown(): add table/table_row cases with GFM separator - richTextToMarkdown(), richTextItemToMarkdown(): helpers for rendering annotated rich_text back to markdown - isTableSeparator(), splitTableRow(), buildTableBlock(): table helpers - block_test.go: TestParseMarkdownTable, TestParseInlineFormatting, TestIsTableSeparator test suites added; all existing tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Notion API validation requires table_row blocks inside table.children (not at block top-level). Fixes 'table.children should be defined' error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Windows build artifact — should not be tracked alongside the unix binary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Merged — thanks for the solid work on this! GFM table parsing + inline formatting is a much-needed addition. The approach of building proper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tableblock:parseMarkdownToBlocks()now detects pipe-delimited tables and converts them totable/table_rowblocks per Notion API spec (table.children, not top-levelchildren)parseInlineFormatting()tokenizes**bold**,*italic*,_italic_,`code`,~~strike~~,[link](url)intorich_textannotation arrays — applied to all block types including table cellsrenderBlockMarkdown()gainstable/table_rowcases that output GFM-style markdown with separator rowisTableSeparator(),splitTableRow(),buildTableBlock(),richTextToMarkdown(),richTextItemToMarkdown()Motivation
Uploading markdown documents with tables via
block append --filepreviously silently dropped or mangled table rows. This makes tables a first-class citizen, consistent with Notion API's native table support.Test plan
TestParseMarkdownTable— basic table, alignment markers, no-separator fallback, mixed contentTestParseInlineFormatting— bold, italic (*and_), code, strikethrough, link, mixedTestIsTableSeparator— various separator patterns including:---:,---:go test ./...)Notes
table_widthare padded; extra cells are trimmed