Skip to content

Conversation

@jaapio
Copy link
Contributor

@jaapio jaapio commented Sep 12, 2025

This feature will allow documentation writers to have a live reload of there changes.

To test this out check out the this branch:
run the following command: make vendor docker-build

Now you can run the application using the normal docker command:

docker run --rm -v $(pwd):/project -it typo3-docs:local --config=Documentation

This will change nothing, if you want to enable watch mode to rerender on changes you can run:

docker run --rm -p 1337:1337 -v $(pwd):/project -it typo3-docs:local --config=Documentation --watch

This will start a local webserver on port 1337, this is available the application will print it to your console.
http://localhost:1337

This local webserver will automatically inject the required javascript to enable the hot reload. If you want to see it's enabled you can use the network inspector of your browser to see if there is a request done which returns a 101 response which means the connection is promoted to a websocket connection.

Todo:

  • update ddev
  • update readme to include the example commands

@linawolf
Copy link
Member

Can I already try this out, if so how?

@jaapio
Copy link
Contributor Author

jaapio commented Sep 13, 2025

Right now you can build the docker image local from this branch. Don't forget to run composer install first.

Now you run: docker run -it --rm --user $(id -u):$(id -g) -v${PWD}:/project -p 1337:1337 typo3-docs:local --watch

When you visit http://localhost:1337/Index.html you should see your documentation. If you edit your index.rst file you should see that the rendering starts again and when finished your browser page reloads.

To stop the server again you can press CTRL+c.

Right now this branch does not contain any method to disable the behavior to start the dev server. This will be added in a later commit.

@garvinhicking
Copy link
Contributor

Just to add to our slack discussion: I now tried this just with "make docker-build" and then your docker run command. This works for me on a basic level. However I for example renamed an anchor inside one file, then the rendering caught that on and spewed out dozens of pages of "dupllicate anchors":

I did that with the TYPO3 EXT:form extension: https://gist.github.com/garvinhicking/ee3a65890ad5a8ff85c32d328a82c30b

@garvinhicking
Copy link
Contributor

When I render EXT:form with the current deployed container it renders fine, with this one I get a couple of errors:

Parsing: 117/117 [=] 100% Parsed 117 files in 1.77 seconds
Rendering:   7/117 [>]   5% Output format html: Rendering: //D/FormEditor/Index.html
[2025-09-19T17:57:13.983933+00:00] app.WARNING: Inventory link with key "typo3/cms-form:apireference-formeditor-events-beforeformiscreatedevent" (apireference-formeditor-events-beforeformiscreatedevent) not found.  {"rst-file":"D/FormEditor/Index","type":"ref","targetReference":"apireference-formeditor-events-beforeformiscreatedevent","value":"BeforeFormIsCreatedEvent","linkType":"std:label","interlinkDomain":"typo3/cms-form"} []
[2025-09-19T17:57:13.984571+00:00] app.WARNING: Inventory link with key "typo3/cms-form:apireference-formeditor-events-beforeformissavedevent" (apireference-formeditor-events-beforeformissavedevent) not found.  {"rst-file":"D/FormEditor/Index","type":"ref","targetReference":"apireference-formeditor-events-beforeformissavedevent","
Rendering: 117/117 [=] 100% Output format html: Rendered 117 documents in 1.39 seconds
[2025-09-19T17:57:14.806356+00:00] app.WARNING: Inventory link with key "typo3/cms-form:apireference-formeditor-events-beforeformiscreatedevent" (apireference-formeditor-events-beforeformiscreatedevent) not found.  {"rst-file":"D/FormEditor/Index","type":"ref","targetReference":"apireference-formeditor-events-beforeformiscreatedevent","value":"BeforeFormIsCreatedEvent","linkType":"std:label","interlinkDomain":"typo3/cms-form"} []
[2025-09-19T17:57:14.806413+00:00] app.WARNING: Inventory link with key "typo3/cms-form:apireference-formeditor-events-beforeformiscreatedevent" (apireference-formeditor-events-beforeformiscreatedevent) not found.  {"rst-file":"D/FormEditor/Index","type":"ref","targetReference":"apireference-formeditor-events-beforeformiscreatedevent","value":"BeforeFormIsCreatedEvent","linkType":"std:label","interlinkDomain":"typo3/cms-form"} []
[2025-09-19T17:57:14.806457+00:00] app.WARNING: Inventory link with key "typo3/cms-form:apireference-formeditor-events-beforeformissavedevent" (apireference-formeditor-events-beforeformissavedevent) not found.  {"rst-file":"D/FormEditor/Index","type":"ref","targetReference":"apireference-formeditor-events-beforeformissavedevent","value":"BeforeFormIsSavedEvent","linkType":"std:label","interlinkDomain":"typo3/cms-form"} []
[2025-09-19T17:57:14.806490+00:00] app.WARNING: Inventory link with key "typo3/cms-form:apireference-formeditor-events-beforeformissavedevent" (apireference-formeditor-events-beforeformissavedevent) not found.  {"rst-file":"D/FormEditor/Index","type":"ref","targetReference":"apireference-formeditor-events-beforeformissavedevent","
Rendering: 117/117 [=] 100% Output format html: Rendered 117 documents in 1.95 seconds
Rendering: 117/117 [=] 100% Output format singlepage: Rendered 117 documents in 0.57 seconds
Rendering: 117/117 [=] 100% Output format interlink: Rendered 117 documents in 0.01 seconds
Successfully placed 117 rendered HTML, SINGLEPAGE, and INTERLINK files into /project/Documentation-GENERATED-temp
Server running at http://localhost:1337
Press Ctrl+C to stop the server

not sure if that is caused by the different dev-process or the other changes in guides?

@jaapio jaapio force-pushed the taks/serve-command branch 2 times, most recently from 45902bc to c5ff68a Compare October 17, 2025 19:16
@jaapio jaapio force-pushed the taks/serve-command branch 2 times, most recently from 730a464 to b8fd8a0 Compare October 26, 2025 10:52
@jaapio jaapio marked this pull request as ready for review October 26, 2025 10:52
@jaapio
Copy link
Contributor Author

jaapio commented Oct 26, 2025

I think this PR is ready for testing, I would love to get your feedback on the new function. Please not that I created a separate pr #1091 for an extra performance boost for projects with large menu structures. It might be useful to test those together.

I have a publication ready for on the website to announce this feature, I will update the documentation later on. So people can learn how to use this new function and what to expect.
Please note that not all file changes are detected. So for now I only focused on changes of existing files. More will follow but I think this is already a good start.

@jaapio jaapio force-pushed the taks/serve-command branch 2 times, most recently from 66b474d to 1b399b3 Compare October 26, 2025 11:47
@linawolf
Copy link
Member

I tested it and it works great! except for the mentioned missing parts (Documentation, README, DDEV )

The new `--watch` flag on the run command will help documentation
writers to have a "live" rerendering of their documentation. The
command will run the normal rendering once, then changes to existing
files are detected and will trigger a rerender of the changed file.

To speed up the rendering only the changed file is compiled, this
might cause issues in the menu. But that should not be an issue as
the final result is always based on a full render.
@jaapio jaapio merged commit 5f2b5a4 into main Oct 26, 2025
9 checks passed
@jaapio jaapio deleted the taks/serve-command branch October 26, 2025 15:03
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.

3 participants