-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add Creole-style |= table header syntax #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dereuromark
wants to merge
5
commits into
master
Choose a base branch
from
feature/table-header-equals-syntax
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8 +/- ##
============================================
+ Coverage 93.81% 93.87% +0.06%
- Complexity 2049 2067 +18
============================================
Files 74 74
Lines 5495 5552 +57
============================================
+ Hits 5155 5212 +57
Misses 340 340 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ad3e8ae to
09c86ed
Compare
dereuromark
added a commit
that referenced
this pull request
Dec 5, 2025
Addresses TBD items from PR #8: - Row/column spans using || (colspan) and |^ (rowspan) - Multi-line cells using trailing \ continuation - Interaction between |= headers and spanning syntax All features are strictly opt-in and compatible with original djot specs.
7080f78 to
ea5d384
Compare
dereuromark
added a commit
that referenced
this pull request
Dec 5, 2025
Implements cell spanning syntax for tables: - Colspan: || (empty cells) after content spans multiple columns - Rowspan: |^| continues a cell from the row above - Header rowspan: |=^ for header cells that span rows Features: - TableCell node now has colspan and rowspan properties - HtmlRenderer outputs colspan/rowspan attributes - Compatible with |= header syntax from PR #8 - Standard djot tables work unchanged (opt-in extension) Syntax examples: - |= Header || (colspan=2) - |^ | (rowspan continuation) - |=^ | (header rowspan)
Adds support for marking individual cells as headers using the |= prefix (Creole/MediaWiki-style syntax). This enables: - Headers without requiring a separator row - Mixed header and data cells in the same row - Row headers on the left side of tables - Inline alignment markers: |=< (left), |=> (right), |=~ (center) The marker must be directly attached to the pipe character to be recognized as a header (|= is header, | = is literal content). This feature integrates cleanly with the existing table spanning features (colspan with <, rowspan with ^, and multi-line cells with +).
25b208c to
4967fca
Compare
Tests cover:
- Multi-line cells with + continuation
- Cell attributes with {.class}= syntax
- Combined rowspan and colspan
- Rowspan from headers into data rows
- Continuation rows don't create new headers
- Multiple header rows with different alignments
- Row header pattern (first column as headers)
The header marker now comes before attributes for better visual clarity:
- New (preferred): |={.class} Header |
- Combined: |=<{.class} Header | (alignment then attributes)
- Old syntax |{.class}= still works via cell-level attributes
Order: |= [alignment] [{attributes}] content
This keeps |= together as a visual unit, making it clearer that
the cell is a header with optional modifiers.
When using both alignment markers (|=<) and explicit style attributes
({style="..."}), the renderer now properly merges them into a single
style attribute instead of creating duplicate style attributes.
Example: |=<{style="color: red"} text |
Before: style="color: red" style="text-align: left;"
After: style="text-align: left; color: red"
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
This PR adds Creole-style
|=table header syntax to djot-php, providing a more flexible way to mark individual cells as headers.Features
1. Creole-style Header Cells (
|=)Mark individual cells as headers using the
|=prefix (must be directly attached to pipe):Renders as:
2. Cell Alignment Markers
Alignment markers must be directly attached to
|=(no space):|=< text|=> text|=~ textExample:
Header alignment propagates to data cells below when no separator row is present.
3. Row Headers
This syntax enables row headers on the left side of tables:
4. Mixed Header/Data Cells
Mix header and regular cells in the same row:
Compatibility Notes
Important: The
=must be directly attached to the pipe character:|= text| = text|=<|= <Additional compatibility:
|---|) continues to work|=alignment<), rowspan (^), and multi-line cells (+)Test Coverage
Related