feat: add _p block for standalone styled paragraphs - #13
Open
connorferster wants to merge 6 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j
Renders a paragraph flowable directly, so an author can emit body text after another block without introducing a heading key first. Accepts a bare string (default style) or a mapping with 'content'/'text' and an optional 'style' naming a text style family. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j
Keep the _ul/_ol and _nextpagetemplate rows (both have real sections in this file) and the richer _pagebreak description. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j
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
Adds a new
_pblock that emits a standalone paragraph, so an author can write body text after another block without first introducing a heading key (and without a bare list item, which gives no control over the text style).Two value forms:
contentholds the text;textis accepted as an alias.styleselects a text style family (the same named families as_style.styles/_textstyle), rendered in that family's body role. Defaults todefault. An unknown style raisesYMPrintSyntaxExceptionlisting the available families.convert_paragraph, so inline markdown and{{variable}}interpolation work as in ordinary body text.Implementation
src/ymprint/blocks/p_block.py— the converter plusregister_block("_p", …). Family validation is inlined to avoid a circular import (story_builderimports the block registry).report_reader.pyalongside the other blocks.Tests
tests/test_p_block.py— 10 tests covering all value forms, thetextalias, named-family styling, error paths (unknown style, missing content, invalid value type), markdown/Jinja rendering, and an end-to-endbuild_storycase. Full suite: 76 passed. Also verified end-to-end with a realym convertrender.Docs
docs/reference/blocks.md: new(block-p)=section and catalogue row.README.md:_prow in the blocks table.Note
docs/reference/blocks.mdcontains a pre-existing, committed git merge-conflict marker (<<<<<<< HEAD … >>>>>>>) around the catalogue table — unrelated to this change. I placed the new catalogue row above it and left the conflict untouched; it should be resolved separately.🤖 Generated with Claude Code
https://claude.ai/code/session_014MCYhna7e6jhcunu3DCT6j