Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 9, 2025

This PR implements the complete MdNotion class with a fluent API as specified in the requirements, along with fetch methods for Page and Database objects, Blade template customization, and comprehensive documentation.

Tasks Completed ✅

  • Initial MdNotion class implementation with fluent API
  • ContentBuilder for method chaining
  • Fetch methods for Page and Database objects
  • Service Provider integration
  • Comprehensive testing
  • Recursive database items content reading
  • Task 1: Allow empty pageId with setPage method and validation
  • Task 2: Use Blade components for markdown rendering with configurable templates
  • Task 3: Create example PHP script using MdNotion facade
  • Blade Template Refactoring: Separate logic from view by moving data building to PHP methods
  • Documentation Update: Added Features section, updated Usage examples, and comprehensive Customization guide

Task 1 Implementation ✅

  • Modified MdNotion constructor to accept empty pageId
  • Added setPage() method with fluent interface
  • Added validation in all finalizing methods (get(), read(), full())
  • Throws InvalidArgumentException when pageId is not set
  • Updated tests to cover all validation scenarios

Task 2 Implementation ✅

  • Created Blade templates: page-md.blade.php and full-md.blade.php
  • Updated config to include template configuration paths
  • Modified ContentBuilder::read() to use Blade templates
  • Modified MdNotion::full() to use Blade templates
  • Templates are configurable via config file
  • Added comprehensive tests to verify Blade template usage
  • Improved template formatting and spacing

Task 3 Implementation ✅

  • Created mdnotion-facade-example.php script with full documentation
  • Script demonstrates all MdNotion facade methods including:
    • MdNotion::make($pageId)->full() - complete recursive content
    • MdNotion::make($pageId)->pages() - child pages collection
    • MdNotion::make($pageId)->databases() - child databases collection
    • MdNotion::make($pageId)->content()->withPages()->withDatabases()->get() - page object
    • MdNotion::make($pageId)->content()->withPages()->withDatabases()->read() - markdown content
    • MdNotion::make()->setPage($pageId)->full() - using setPage method
  • Includes proper Laravel container setup for standalone usage
  • Creates storage directory automatically
  • Saves complete output to notion-full.md
  • Comprehensive error handling and user guidance

Blade Template Refactoring ✅

  • Refactored MdNotion::full() method to build structured data arrays before passing to template
  • Refactored ContentBuilder::read() method to build structured data collections
  • Updated full-md.blade.php to use structured data variables instead of complex logic
  • Updated page-md.blade.php to use structured data variables instead of direct object access
  • Templates now receive ready-to-use variables like:
    • current_page with rendered title and content
    • child_databases with rendered table, title and child pages
    • child_pages with rendered title and content
    • Boolean flags like hasChildPages, hasChildDatabases
  • Better separation of concerns between logic (PHP) and presentation (Blade)

Documentation Update ✅

  • Features Section: Added comprehensive features list with emojis and clear descriptions including fluent API, page reading, database support, recursive fetching, customizable templates, custom adapters, Laravel integration, and configurable options
  • Updated Usage Section: Replaced single large example with multiple focused examples:
    • Basic page content reading with return value examples
    • Fetching child pages and databases collections
    • Content with children (withPages/withDatabases) with formatted markdown output
    • Complete recursive content with API request warning
    • Dynamic page setting for runtime scenarios
    • Raw page object access for advanced use cases
  • Customization Section: Complete guide including:
    • Custom Blade templates with detailed examples and variable references
    • Custom block adapters with interface implementation and registration
    • Configuration examples for template paths and adapter mappings
    • Available template variables reference for both page and full templates
  • Configuration Section: Added Notion API key setup instructions and integration steps
  • Updated Installation: Fixed config file content display and view publishing command syntax
  • Updated Examples: Fixed facade namespace and improved code examples throughout

Additional Testing ✅

  • Added ContentBuilderTest.php for testing ContentBuilder validation
  • Added BladeTemplateTest.php for testing template rendering
  • Enhanced existing tests with edge cases and validation scenarios
  • All tests verify proper exception handling and method chaining

Implementation Details

All changes maintain backward compatibility while adding extensive customization capabilities. The Blade templates provide clean separation between logic and presentation, with PHP methods building structured data and templates focusing purely on rendering.

The documentation now provides clear examples for each use case, comprehensive customization options for both templates and block adapters, and proper setup instructions for getting started with Notion API integration.

Developers can now easily extend the package with custom block adapters for specialized content types and create personalized markdown templates that suit their specific formatting needs.

All code follows PSR-12 standards and has been formatted with Laravel Pint.

Fixes #4.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] MdNotion class implementation Implement MdNotion class with fluent API and fetch methods for Page and Database objects Sep 9, 2025
@Copilot Copilot AI requested a review from MaestroError September 9, 2025 14:10
Copilot finished work on behalf of MaestroError September 9, 2025 14:10
Copy link
Collaborator

@MaestroError MaestroError left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot I added one change request and one question

Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 9, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/CarbonPHP/carbon/zipball/8e3643dcd149ae0fe1d2ff4f2c8e4bbfad7c165f
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/Seldaek/monolog/zipball/10d85740180ecba7896c87e06a166e0c95a0e3b6
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/brick/math/zipball/113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/dragonmantank/cron-expression/zipball/8c784d071debd117328803d86b2097615b457500
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/filp/whoops/zipball/d2102955e48b9fd9ab24280a7ad12ed552752c4d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/fruitcake/php-cors/zipball/3d158f36e7875e2f040f37bc0573956240a5a38b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/uri-template/zipball/4f4bbd4e7172148801e76e3decc1e559bdee34e1
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/hamcrest/hamcrest-php/zipball/f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/laravel/framework/zipball/868c1f2d3dba4df6d21e3a8d818479f094cfd942
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/laravel/pint/zipball/0345f3b05f136801af8c339f9d16ef29e6b4df8a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/laravel/prompts/zipball/86a8b692e8661d0fb308cec64f3d176821323077
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/laravel/serializable-closure/zipball/b352cf0534aa1ae6b4d825d1e762e35d43f8a841
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/nette/utils/zipball/c930ca4e3cf4f17dcfb03037703679d2396d2ede
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/nunomaduro/termwind/zipball/dfa08f390e509967a15c22493dc0bac5733d9123
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/orchestral/canvas-core/zipball/22b6515e7a070e1c45c8a3a9819f8b6cb0234173
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/orchestral/sidekick/zipball/0f7d1d96d390e7bf9118f280dfae74b8b2fb0a00
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/orchestral/testbench/zipball/87a7cb58edcfea9b1f26a63761c4d7ed5448f560
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/orchestral/workbench/zipball/4e8a5a68200971ddb9ce4abf26488838bf5c0812
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/25bb17e37920ccc35cbbcda3b00d596aadf3e58d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/pestphp/pest-plugin-laravel/zipball/e12a07046b826a40b1c8632fd7b80d6b8d7b628e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/pestphp/pest-plugin-mutate/zipball/d9b32b60b2385e1688a68cc227594738ec26d96c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/pestphp/pest-plugin-profanity/zipball/823d5d8ae07a265c70f5e1a9ce50639543b0bf11
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/pestphp/pest-plugin/zipball/9d4b93d7f73d3f9c3189bb22c220fef271cdf568
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/1hQJ19 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/pestphp/pest/zipball/47fb1d77631d608022cc7af96cac90ac741c8394
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94f8051919d1b0369a6bcc7931d679a511c03fe9
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1e0cd5370df5dd2e556a36b9c62f62e555870495
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/saloonphp/saloon/zipball/b1868db2d7c2eea57592b78797f24e8cddfb86cc
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/schmittjoh/php-option/zipball/638a154f8d4ee6a5cfa96d6a34dfbe0cffa9566d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/sebastianbergmann/environment/zipball/24a711b5c916efc6d6e62aa65aa2ec98fef77f68
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/spatie/laravel-package-tools/zipball/f09a799850b1ed765103a4f0b4355006360c49a5
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/clock/zipball/b81435fbd6648ea425d1ee96a2d8e68f4ceacd24
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/console/zipball/cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/css-selector/zipball/601a5ce9aaad7bf10797e3663faefce9e26c24e2
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/1hQJ19 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/error-handler/zipball/0b31a944fcd8759ae294da4d2808cbc53aebd0c3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/event-dispatcher/zipball/b7dc69e71de420ac04bc9ab830cf3ffebba48191
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/finder/zipball/2a6614966ba1074fa93dae0bc804227422df4dfe
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/http-foundation/zipball/7475561ec27020196c49bb7c4f178d33d7d3dc00
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/http-kernel/zipball/72c304de37e1a1cec6d5d12b81187ebd4850a17b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/mailer/zipball/a32f3f45f1990db8c4341d5122a7d3a381c7e575
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/mime/zipball/e0a0f859148daf1edf6c60b398eb40bfc96697d1
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/1hQJ19 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/1hQJ19 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-uuid/zipball/21533be36c24be3f4b1669c4725c7d1d2bab4ae2
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/process/zipball/32241012d521e2e8a9d713adb0812bb773b907f1
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/routing/zipball/7614b8ca5fa89b9cd233e21b627bfc5774f586e4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/string/zipball/17a426cce5fd1f0901fefa9b2a490d0038fd3c9c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/translation-contracts/zipball/df210c7a2573f1913b2d17cc95f90f53a73d8f7d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/translation/zipball/e0837b4cbcef63c754d89a4806575cada743a38d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/uid/zipball/a69f69f3159b852651a6bf45a9fdd149520525bb
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/var-dumper/zipball/34d8d4c4b9597347306d1ec8eb4e1319b1e6986f
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/yaml/zipball/d4f4a66866fe2451f61296924767280ab5732d9d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/cf6fb197b676ba716837c886baca842e4db29005
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/thephpleague/flysystem-local/zipball/6691915f77c7fb69adfb87dcd550052dc184ee10
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/thephpleague/flysystem/zipball/2203e3151755d874bb2943649dae1eb8533ac93e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0d72ac1c00084279c1816675284073c5a337c20d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/voku/portable-ascii/zipball/b1d923f88091c6bf09699efcd7c8a1b1bfd7351d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/MBL3sB /usr/bin/composer install --no-interaction --prefer-dist (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title Implement MdNotion class with fluent API and fetch methods for Page and Database objects Implement MdNotion class with fluent API, fetch methods, and recursive database items content reading Sep 9, 2025
@Copilot Copilot AI requested a review from MaestroError September 9, 2025 14:39
Copilot finished work on behalf of MaestroError September 9, 2025 14:39
@MaestroError
Copy link
Collaborator

@copilot

Task 1

Let's keep empty pageId with MdNotion, just add new setPage method which receives page ID and throw exception on at start of finilizing methods (get, read & full) if pageId is not set.

Task 2

Also, instead of building markdown in method, let's use Blade components to render markdown from read & full methods to make sure developers can customize layout and output of these. Also, make this blade templates easily changeable via the config file. Name them as page-md.blade.php and full-md.blade.php

Ensure we have test to check if output of these methods matches blade templates

Task 3

Create example PHP script with the MdNotion facade, grab full page and save it as "notion-full.md". Check page-reader-example.php for insights.

Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 9, 2025

@copilot

Task 1

...

All three tasks completed successfully:

Task 1 ✅ - Added setPage() method and validation in finalizing methods. Empty pageId is now allowed and validation throws InvalidArgumentException when needed.

Task 2 ✅ - Created Blade templates page-md.blade.php and full-md.blade.php with configurable paths in config. Both read() and full() methods now use Blade rendering.

Task 3 ✅ - Created mdnotion-facade-example.php script demonstrating all MdNotion facade methods and saving output to notion-full.md.

All tests updated to verify the new functionality. Commit: fe5c9c4

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/doctrine/inflector/zipball/6d6c96277ea252fc1304627204c3d5e6e15faa3b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/dragonmantank/cron-expression/zipball/8c784d071debd117328803d86b2097615b457500
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/pestphp/pest-plugin/zipball/9d4b93d7f73d3f9c3189bb22c220fef271cdf568
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/process/zipball/32241012d521e2e8a9d713adb0812bb773b907f1
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/string/zipball/17a426cce5fd1f0901fefa9b2a490d0038fd3c9c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/sbWpEe /usr/bin/composer install (http block)
  • https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VA50sX /usr/bin/composer install --no-dev (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Copilot finished work on behalf of MaestroError September 9, 2025 15:21
Copy link
Collaborator

@MaestroError MaestroError left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please check my comments and refactor blade templates. After that, start with the new tasks:

Add Customization

Check the README.md file and add new section "Customization" and sub sections under it to explain how developers can create custom adapters for blocks and how they can change the full-md and page-md templates with their custom blade templates. Add small simple and clear examples.

Update Usage

Also, we have ## Usage section in README.md, please review the usage section and update:

  • Instead one big example, separate it Extend with different examples and add descriptions to the examples.
  • Each usage example should be returning something and please provide explanation/example of what returned
  • Remove readAllPagesContent Add full method with warning note

Add features section

Above the Usage section add Features section with list of the most useful features MdNotion have. Use emojis and write clear, easy to understand text.

return $markdown;
}
echo trim(buildFullMarkdown($page));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In using blade, I didn't mean just pulling PHP method body in blade template file. Instead this, please return all logic back to methods which will build data and pass to the blade:

  • current_page -> collection with rendered title and content
  • child_databases -> collection of database arrays which have rendered table, title and child_pages with rendered title and content
  • child_pages -> collection of pages with rendered title and content

Also pass variables like $hasChildPage and etc.
And use these all these variable in Blade template to render needed markdown

Comment on lines 1 to 33
{!! $page->renderTitle(1) !!}

@if($page->hasContent())

{!! $page->getContent() !!}

@endif
@if($withDatabases && $page->hasChildDatabases())

## Databases

@foreach($page->getChildDatabases() as $database)
{!! $database->renderTitle(3) !!}

@if($database->hasTableContent())
{!! $database->getTableContent() !!}

@endif
@endforeach
@endif
@if($withPages && $page->hasChildPages())

## Child Pages

@foreach($page->getChildPages() as $childPage)
{!! $childPage->renderTitle(3) !!}

@if($childPage->hasContent())
{!! $childPage->getContent() !!}

@endif
@endforeach
@endif No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's take the same approach here as I commented on full-md template, directly pass ready-to-use variables to the template

@MaestroError
Copy link
Collaborator

MaestroError commented Sep 9, 2025

@copilot I requested changes and asked for documentation update, please check my review comments and proceed 🙏

@MaestroError MaestroError assigned Copilot and unassigned Copilot Sep 9, 2025
@MaestroError
Copy link
Collaborator

@copilot

@MaestroError
Copy link
Collaborator

@copilot Please check my comments and refactor blade templates. After that, start with the new tasks:

Add Customization

Check the README.md file and add new section "Customization" and sub sections under it to explain how developers can create custom adapters for blocks and how they can change the full-md and page-md templates with their custom blade templates. Add small simple and clear examples.

Update Usage

Also, we have ## Usage section in README.md, please review the usage section and update:

  • Instead one big example, separate it Extend with different examples and add descriptions to the examples.
  • Each usage example should be returning something and please provide explanation/example of what returned
  • Remove readAllPagesContent Add full method with warning note

Add features section

Above the Usage section add Features section with list of the most useful features MdNotion have. Use emojis and write clear, easy to understand text.

@copilot let's start by refactoring blade templates

…ding to PHP methods

Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 10, 2025

@copilot Please check my comments and refactor blade templates. After that, start with the new tasks:

Add Customization...

I've refactored the Blade templates to properly separate logic from view. The PHP methods now build structured data collections and pass ready-to-use variables to templates:

  • current_page with rendered title and content
  • child_databases with rendered table, title and child pages
  • child_pages with rendered title and content
  • Boolean flags like hasChildPages, hasChildDatabases

Templates are now much cleaner and focus purely on rendering. Commit: ca320db

Now I'll proceed with the documentation updates (Customization, Usage, and Features sections).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/pestphp/pest-plugin/zipball/9d4b93d7f73d3f9c3189bb22c220fef271cdf568
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mBFdO7 /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mBFdO7 /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mBFdO7 /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mBFdO7 /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/process/zipball/32241012d521e2e8a9d713adb0812bb773b907f1
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mBFdO7 /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/string/zipball/17a426cce5fd1f0901fefa9b2a490d0038fd3c9c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mBFdO7 /usr/bin/composer install (http block)

If you need me to access, download, or install something from one of these locations, you can either:

…d Customization guide

Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
@Copilot Copilot AI changed the title Implement MdNotion class with fluent API, fetch methods, and recursive database items content reading Implement MdNotion class with fluent API, fetch methods, Blade template customization, and comprehensive documentation Sep 10, 2025
@Copilot Copilot AI requested a review from MaestroError September 10, 2025 07:16
Copilot finished work on behalf of MaestroError September 10, 2025 07:16
@MaestroError MaestroError marked this pull request as ready for review September 10, 2025 12:35
@MaestroError MaestroError merged commit b663c3c into main Sep 10, 2025
@MaestroError MaestroError deleted the copilot/add-fetch-methods-to-mdnotion branch October 3, 2025 12:52
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.

MdNotion class implementation

2 participants