feat(block): 'block update' accepts --file markdown and --markdown for inline#45
Merged
Conversation
…r inline Closes #36. Brings 'block update' in line with 'block append' / 'block insert', which have supported markdown input since earlier releases. New flags: --file <path> read markdown from a file; must parse to exactly one block. Fails fast on type mismatch because Notion's PATCH /v1/blocks/:id cannot change a block's type. Code-fence language aliases from #22 apply here, so --file with a 'ts' / 'sh' / 'yml' fence still works. --markdown when combined with --text, runs the inline parser (bold / italic / code / strikethrough / links). Mutual-exclusion and validation: - --text and --file are mutually exclusive. - --markdown is implied for --file; supplying both is rejected. - At least one of --text / --file is required. - --file preserves type-specific inner fields (code.language, to_do. checked, etc.) from the parsed block. Logic extracted to buildUpdateBlockBody() so it's unit-testable without network. Tests cover plain text, --markdown annotations, --file parsing with language normalization, type mismatch, multi-block rejection, and missing-file errors. Smoke-tested end-to-end: paragraph → plain update, paragraph → markdown update with links/bold, code block → sh-alias update normalized to 'shell', and the type-mismatch guard fires correctly.
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.
Closes #36. Brings
block updatein line withblock append/block insert.--file <path>— markdown must parse to exactly one block; type must match.--markdown— when combined with--text, runs inline parser.--text/--filemutually exclusive; at least one required.Smoke-tested: plain, markdown with bold/link, code block with 'sh' alias, and the type-mismatch guard.