Skip to content

feat: add _p block for standalone styled paragraphs - #13

Open
connorferster wants to merge 6 commits into
mainfrom
features/p-block
Open

feat: add _p block for standalone styled paragraphs#13
connorferster wants to merge 6 commits into
mainfrom
features/p-block

Conversation

@connorferster

Copy link
Copy Markdown
Contributor

Summary

Adds a new _p block 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:

- _p: A quick paragraph in the default style.     # bare string

- _p:
    content: Small print after a figure.          # mapping form
    style: fine-print                             # any _style.styles family
  • content holds the text; text is accepted as an alias.
  • style selects a text style family (the same named families as _style.styles / _textstyle), rendered in that family's body role. Defaults to default. An unknown style raises YMPrintSyntaxException listing the available families.
  • Reuses convert_paragraph, so inline markdown and {{variable}} interpolation work as in ordinary body text.

Implementation

  • src/ymprint/blocks/p_block.py — the converter plus register_block("_p", …). Family validation is inlined to avoid a circular import (story_builder imports the block registry).
  • Registered in report_reader.py alongside the other blocks.

Tests

tests/test_p_block.py — 10 tests covering all value forms, the text alias, named-family styling, error paths (unknown style, missing content, invalid value type), markdown/Jinja rendering, and an end-to-end build_story case. Full suite: 76 passed. Also verified end-to-end with a real ym convert render.

Docs

  • docs/reference/blocks.md: new (block-p)= section and catalogue row.
  • README.md: _p row in the blocks table.

Note

docs/reference/blocks.md contains 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

connor-sp and others added 6 commits September 5, 2026 01:52
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants