-
Notifications
You must be signed in to change notification settings - Fork 0
Page properties table #9
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds comprehensive support for rendering Notion page properties as markdown tables. The implementation includes a new PropertiesTable service for converting property data to markdown, updates to the Page object to expose property rendering functionality, and modifications to Blade templates and data structures to include property tables in the generated markdown output.
Key Changes
- Introduced
PropertiesTableservice with support for 15+ Notion property types including title, rich_text, URL, email, date, number, checkbox, select, multi_select, status, people, files, relations, rollups, and formulas - Added
renderPropertiesTable()method to thePageobject for generating markdown property tables - Updated data assembly in
ContentBuilderandMdNotionto includeproperties_tableandhasPropertiesTablefields - Enhanced Blade templates to conditionally render property tables for current and child pages
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Services/PropertiesTable.php | New service class that converts Notion page properties into markdown tables with comprehensive property type support |
| src/Objects/Page.php | Added renderPropertiesTable() method to generate property tables using the PropertiesTable service |
| src/MdNotion.php | Updated buildFullMarkdownData() to include properties_table and hasPropertiesTable fields in page data |
| src/ContentBuilder.php | Updated data assembly to include property table fields for current and child pages |
| resources/views/page-md.blade.php | Added conditional rendering of properties table for current and child pages |
| resources/views/full-md.blade.php | Added conditional rendering of properties table for current page |
| tests/Services/PropertiesTableTest.php | Comprehensive test suite covering all supported property types with 28 test cases |
| tests/Objects/PropertiesTest.php | Tests for Page object property methods including detection, rendering, and accessors |
| tests/BladeTemplateTest.php | Updated existing tests to include new properties_table fields in test data |
| examples/properties-fetch-example.php | Example script demonstrating how to fetch and render page properties |
| examples/properties-example.md | Sample markdown output showing rendered property table |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Services/PropertiesTable.php
Outdated
| continue; | ||
| } | ||
|
|
||
| $markdown .= "| {$name} | {$value} |\n"; |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Property names and values containing pipe characters (|) will break the markdown table formatting. These characters should be escaped (e.g., using backslash \|) before being inserted into the table to prevent table structure corruption.
For example, if a property name is "A | B" or a value contains "|", the resulting markdown table will be malformed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
And this feedback: #9 (comment)
src/Services/PropertiesTable.php
Outdated
| continue; | ||
| } | ||
|
|
||
| $markdown .= "| {$name} | {$value} |\n"; |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Property values containing newline characters (\n or \r) will break the markdown table formatting. Multi-line values should either be escaped (e.g., replaced with <br> or spaces) or truncated to maintain valid markdown table structure.
For example, if a rich_text or other property value contains line breaks, it will create invalid markdown table rows.
| $markdown .= "| {$name} | {$value} |\n"; | |
| // Replace newlines in name and value to avoid breaking markdown table | |
| $safeName = str_replace(["\n", "\r"], ' ', $name); | |
| $safeValue = str_replace(["\n", "\r"], ' ', $value); | |
| $markdown .= "| {$safeName} | {$safeValue} |\n"; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@MaestroError I've opened a new pull request, #10, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Escape pipe characters and newlines in markdown table cells
This pull request adds support for rendering Notion page properties as markdown tables, both in the backend data structures and in the Blade templates. It introduces a new
PropertiesTableservice to handle property formatting, updates the core page object to expose arenderPropertiesTable()method, and ensures that markdown output and Blade views include property tables when available. Comprehensive tests are added to validate property handling and rendering.Backend: Property Table Generation
PropertiesTableservice (src/Services/PropertiesTable.php) to convert Notion page properties into markdown tables, supporting various property types and formatting logic.renderPropertiesTable()method in thePageobject to generate markdown tables using the new service.Data Structure Updates
ContentBuilderandMdNotionto includeproperties_tableandhasPropertiesTablefields for both current and child pages, enabling templates to conditionally render property tables. [1] [2] [3]Blade Template Enhancements
page-md.blade.phpandfull-md.blade.phpto display the properties table if available for both current and child pages. [1] [2] [3]Testing
PropertiesTest.php, covering detection, rendering, and access of properties.BladeTemplateTest.phpto account for the new properties table fields, ensuring template rendering works as expected. [1] [2] [3] [4]Example and Usage
examples/properties-fetch-example.php) and corresponding markdown output (examples/properties-example.md) to demonstrate fetching and rendering page properties as markdown. [1] [2]