Skip to content

Implement JSON builder#8

Closed
wouterj wants to merge 1 commit into
mainfrom
fjson-output
Closed

Implement JSON builder#8
wouterj wants to merge 1 commit into
mainfrom
fjson-output

Conversation

@wouterj
Copy link
Copy Markdown
Owner

@wouterj wouterj commented Mar 10, 2024

Instead of HTML files, Symfony needs .fjson files with the following schema:

array{
    title: string,
    parents: array<int, string>,
    current_page_name: string,
    toc: array<int, array<string, string>>|array{},
    toc_options: array{maxDepth: int, numVisibleItems: int, size: string},
    next: array{title: string, link: string}|null,
    prev: array{title: string, link: string}|null,
    body: string,
}

@wouterj
Copy link
Copy Markdown
Owner Author

wouterj commented Mar 17, 2026

integrated in symfony-tools/docs-builder#200

@wouterj wouterj closed this Mar 17, 2026
Copy link
Copy Markdown
Contributor

@stof stof left a comment

Choose a reason for hiding this comment

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

I started a review yesterday that I forgot to submit.

use phpDocumentor\Guides\Renderer\TypeRenderer;
use phpDocumentor\Guides\Renderer\UrlGenerator\UrlGeneratorInterface;

class JsonRenderer implements TypeRenderer
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should it be FjsonRenderer ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

or maybe JsonHtmlRenderer to be consistent with the Sphinx name

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The "fun" thing about the phpDocumentor implementation is that the project renderer can be another format than the node renderer. So this class actually doesn't care about the format of the body (except for the page link extensions 🤔 ).

Keeping consistency with the Sphinx name, but decoupling it from Html is exactly how I got to the JsonRenderer name.

Thanks for all your review work btw!

Comment thread lib/symfony-extension/src/Renderer/JsonRenderer.php
@wouterj wouterj deleted the fjson-output branch March 18, 2026 20:49
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