generated from spatie/package-skeleton-laravel
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bcd6e15
page properties table added
MaestroError 27415cb
Fix styling
MaestroError bb1443e
Apply suggestions from code review
MaestroError 84dd2a4
Initial plan
Copilot aa430db
Add pipe character escaping for markdown table cells
Copilot 13b9251
Add newline character handling for markdown table cells
Copilot d883376
Merge pull request #10 from RedberryProducts/copilot/sub-pr-9
MaestroError File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Test DB item 1 | ||
|
|
||
| | Property | Value | | ||
| | --- | --- | | ||
| | CheckboxField | ✓ | | ||
| | Type | type-1 | | ||
| | Email | [test@gogmail.com](mailto:test@gogmail.com) | | ||
| | Date | 2025-09-02 | | ||
| | Status | In progress | | ||
| | Priority Level | 3, 2 | | ||
| | Files & media | [ChatGPT Image Sep 3, 2025, 09_59_04 PM.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/0d31a281-d71e-4bb9-9031-a5256095b873/641f2fcb-cf13-4c62-8d9d-2871f34a1a6a/ChatGPT_Image_Sep_3_2025_09_59_04_PM.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAZI2LB466TSVKJSYL%2F20251113%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20251113T142329Z&X-Amz-Expires=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HISPNwbsWULzDE44jpADZk9mxdmROHT1S6Urgn38UlZlo9iAqH2ffG4YjK%2B3HMKWR&X-Amz-Signature=6f39e1d0620132a3ed8b664b8b99adf82929e79cf1dd8f561a2a1153803f36be&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject) | | ||
| | Person | Maestro Error | | ||
| | Name | Test DB item 1 | | ||
|
|
||
|
|
||
|
|
||
|
|
||
| > 💪 Test callout | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| <?php | ||
|
|
||
| require_once __DIR__.'/../vendor/autoload.php'; | ||
|
|
||
| use Illuminate\Container\Container; | ||
| use Illuminate\Events\Dispatcher; | ||
| use Illuminate\Filesystem\Filesystem; | ||
| use Illuminate\Support\Facades\Facade; | ||
| use Illuminate\Support\Facades\View; | ||
| use Illuminate\View\Compilers\BladeCompiler; | ||
| use Illuminate\View\Engines\CompilerEngine; | ||
| use Illuminate\View\Engines\EngineResolver; | ||
| use Illuminate\View\Factory; | ||
| use Illuminate\View\FileViewFinder; | ||
| use Redberry\MdNotion\Adapters\BlockAdapterFactory; | ||
| use Redberry\MdNotion\SDK\Notion; | ||
| use Redberry\MdNotion\Services\BlockRegistry; | ||
| use Redberry\MdNotion\Services\DatabaseReader; | ||
| use Redberry\MdNotion\Services\DatabaseTable; | ||
| use Redberry\MdNotion\Services\PageReader; | ||
| use Redberry\MdNotion\Services\PropertiesTable; | ||
|
|
||
| // Set up Laravel container | ||
| $container = new Container; | ||
| Container::setInstance($container); | ||
|
|
||
| // Set up Facade root | ||
| Facade::setFacadeApplication($container); | ||
|
|
||
| // Register filesystem | ||
| $container->singleton('files', fn () => new Filesystem); | ||
|
|
||
| // Register blade compiler | ||
| $container->singleton('blade.compiler', function ($app) { | ||
| return new BladeCompiler( | ||
| $app['files'], | ||
| __DIR__.'/../storage/views' | ||
| ); | ||
| }); | ||
|
|
||
| // Set up view finder | ||
| $viewFinder = new FileViewFinder( | ||
| $container['files'], | ||
| [__DIR__.'/../resources/views'] | ||
| ); | ||
|
|
||
| // Add namespace for our views | ||
| $viewFinder->addNamespace('md-notion', __DIR__.'/../resources/views'); | ||
|
|
||
| // Set up view factory | ||
| $resolver = new EngineResolver; | ||
| $resolver->register('blade', function () use ($container) { | ||
| return new CompilerEngine($container['blade.compiler']); | ||
| }); | ||
|
|
||
| $factory = new Factory( | ||
| $resolver, | ||
| $viewFinder, | ||
| new Dispatcher($container) | ||
| ); | ||
|
|
||
| // Bind view factory to container | ||
| $container->instance('view', $factory); | ||
| View::setFacadeApplication($container); | ||
|
|
||
| // Initialize the real Notion SDK with token | ||
| $token = include __DIR__.'/../notion-token.php'; | ||
| $notion = new Notion($token, '2025-09-03'); | ||
|
|
||
| // Create services | ||
| $mdNotionConfig = include __DIR__.'/../config/md-notion.php'; | ||
| $blockRegistry = new BlockRegistry(new BlockAdapterFactory($notion, $mdNotionConfig['adapters'] ?? [])); | ||
| $databaseTable = new DatabaseTable; | ||
| $pageReader = new PageReader($notion, $blockRegistry); | ||
| $databaseReader = new DatabaseReader($notion, $databaseTable); | ||
| $propertiesTable = new PropertiesTable; | ||
|
|
||
| // Bind services to container so Page objects can use them | ||
| $container->instance(PropertiesTable::class, $propertiesTable); | ||
|
|
||
| // Use a page ID that has properties (replace with your actual page ID) | ||
| // This should be a page from your Notion workspace that has various properties | ||
| $pageId = '263d9316605a80c0a8fbfd152e79b9d8'; // Replace with a page that has properties | ||
|
|
||
| echo "Fetching page content with properties...\n"; | ||
|
|
||
| try { | ||
| // Read page | ||
| $page = $pageReader->read($pageId); | ||
|
|
||
| echo "Page fetched successfully!\n"; | ||
| echo 'Page title: '.$page->getTitle()."\n"; | ||
| echo 'Has properties: '.($page->hasProperties() ? 'Yes ('.count($page->getProperties()).')' : 'No')."\n"; | ||
| echo 'Content length: '.strlen($page->getContent() ?? '')." characters\n\n"; | ||
|
|
||
| // Build markdown content | ||
| $markdown = ''; | ||
|
|
||
| // Add page title | ||
| $markdown .= $page->renderTitle(1)."\n\n"; | ||
|
|
||
| // Add properties table if available | ||
| if ($page->hasProperties()) { | ||
| $markdown .= $page->renderPropertiesTable()."\n"; | ||
| } | ||
|
|
||
| // Add page content | ||
| if ($page->hasContent()) { | ||
| $markdown .= $page->getContent()."\n\n"; | ||
| } | ||
|
|
||
| // Save to file | ||
| file_put_contents(__DIR__.'/properties-example.md', $markdown); | ||
|
|
||
| echo "Page with properties table converted and saved to examples/properties-example.md\n"; | ||
| echo "\nGenerated markdown:\n"; | ||
| echo "---\n"; | ||
| echo $markdown; | ||
| echo "---\n"; | ||
|
|
||
| } catch (\Exception $e) { | ||
| echo 'Error: '.$e->getMessage()."\n"; | ||
| echo "Stack trace:\n"; | ||
| echo $e->getTraceAsString()."\n"; | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.