|
| 1 | +:navigation-title: Live rendering (WYSIWYG) |
| 2 | + |
| 3 | +.. _rendering-wysiwyg: |
| 4 | +.. _live-rendering: |
| 5 | + |
| 6 | +============================================================ |
| 7 | +Rendering with more WYSIWYG-feeling (automatic re-rendering) |
| 8 | +============================================================ |
| 9 | + |
| 10 | +You want to write complex `reST` markup and directly see the |
| 11 | +rendered output, browser side-by-side with your editor? Then |
| 12 | +this section is for you! |
| 13 | + |
| 14 | +Often, especially in the later stages of creating documentation, you |
| 15 | +just edit small parts of the reST files, render the outcome manually |
| 16 | +and happily commit your changes. |
| 17 | + |
| 18 | +However, in cases you write larger sections of text, you may want |
| 19 | +to get more immediate visual feedback on your changes, but do not |
| 20 | +want to manually trigger the rendering time and again. |
| 21 | + |
| 22 | +To make this easier, `render-guides` can serve the rendered documentation |
| 23 | +via a local web-server and automatically re-render the documentation |
| 24 | +when changes in the source files are detected. This gives you a more |
| 25 | +WYSIWYG-like experience when writing documentation. |
| 26 | + |
| 27 | +This allows you to have a browser window next to your reST file editor |
| 28 | +to view progress. |
| 29 | + |
| 30 | +.. tabs:: |
| 31 | + |
| 32 | + .. group-tab:: Linux |
| 33 | + |
| 34 | + .. code-block:: bash |
| 35 | +
|
| 36 | + docker run --rm -it --pull always \ |
| 37 | + -v "./Documentation:/project/Documentation" \ |
| 38 | + -v "./Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp" \ |
| 39 | + -p 1337:1337 ghcr.io/typo3-documentation/render-guides:latest --config="Documentation" --watch |
| 40 | + xdg-open "http://localhost:1337/Index.html" |
| 41 | +
|
| 42 | + .. group-tab:: MacOS |
| 43 | + |
| 44 | + .. code-block:: bash |
| 45 | +
|
| 46 | + docker run --rm -it --pull always \ |
| 47 | + -v "./Documentation:/project/Documentation" \ |
| 48 | + -v "./Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp" \ |
| 49 | + -p 1337:1337 ghcr.io/typo3-documentation/render-guides:latest --config="Documentation" --watch |
| 50 | + xdg-open "http://localhost:1337/Index.html" |
| 51 | + .. group-tab:: Windows |
| 52 | + |
| 53 | + .. code-block:: powershell |
| 54 | +
|
| 55 | + docker run --rm -it --pull always \ |
| 56 | + -v "./Documentation:/project/Documentation" \ |
| 57 | + -v "./Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp" \ |
| 58 | + -p 1337:1337 ghcr.io/typo3-documentation/render-guides:latest --config="Documentation" --watch |
| 59 | + xdg-open "http://localhost:1337/Index.html" |
| 60 | +
|
| 61 | +The command above can also be added to your project's `Makefile` or |
| 62 | +you can create a bash alias like: |
| 63 | + |
| 64 | +.. code:: bash |
| 65 | +
|
| 66 | + alias render-wysiwyg="docker run --rm -it --pull always \ |
| 67 | + -v './Documentation:/project/Documentation' \ |
| 68 | + -v './Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp' \ |
| 69 | + -p 1337:1337 ghcr.io/typo3-documentation/render-guides:latest --watch" |
| 70 | +
|
| 71 | +.. note:: |
| 72 | + |
| 73 | + If anything on your host operating system already utilizes the TCP port |
| 74 | + `1337` you need to adapt that command to use another free TCP port for you, |
| 75 | + and adapt the port in the web-browser URL. |
| 76 | + You can do this by changing the :bash:`-p` parameter, e.g. to |
| 77 | + :bash:`-p 8080:1337` to use TCP port `8080` on your host system. |
| 78 | + |
| 79 | +Docker compose |
| 80 | +============== |
| 81 | + |
| 82 | +If you are using `docker-compose <https://docs.docker.com/compose/>`_ to manage your |
| 83 | +development environment, you can add a service for the live rendering like this: |
| 84 | + |
| 85 | +.. code-block:: yaml |
| 86 | + :caption: docker-compose.yml |
| 87 | +
|
| 88 | + services: |
| 89 | + render-wysiwyg: |
| 90 | + restart: "no" |
| 91 | + image: ghcr.io/typo3-documentation/render-guides:latest |
| 92 | + ports: |
| 93 | + - "1337:1337" |
| 94 | + volumes: |
| 95 | + - ./Documentation:/project/Documentation |
| 96 | + - ./Documentation-GENERATED-temp:/project/Documentation-GENERATED-temp |
| 97 | + command: ["--config=Documentation", "--watch"] |
| 98 | +
|
| 99 | +.. note:: |
| 100 | + |
| 101 | + Render guides was never optimized for long running services. You might need |
| 102 | + to restart the container from time to time to free up resources. |
| 103 | + |
| 104 | +DDEV |
| 105 | +==== |
| 106 | + |
| 107 | +For integration with DDEV projects, a DDEV addon has been created at https://github.com/TYPO3-Documentation/ddev-typo3-docs. |
| 108 | +This can be used to automatically start the live documentation preview within the DDEV project at http://<yourproject>.ddev.site:1337/ |
| 109 | +whenever you start that project, and can directly view and work on documentation alongside the project. |
| 110 | +In this environment, users do not even need to execute a manual `docker run` command anymore, and have full integration at hand. |
| 111 | + |
| 112 | +Limitations |
| 113 | +=========== |
| 114 | + |
| 115 | +Not all changes in the source files can be detected automatically, or will |
| 116 | +impact the rendered output immediately. In such cases, a manual re-rendering |
| 117 | +is required. Examples are: |
| 118 | + |
| 119 | +* Changes in :file:`guides.xml` |
| 120 | +* New added files |
| 121 | +* Menu changes |
| 122 | +* Moving files |
| 123 | + |
| 124 | +.. note:: |
| 125 | + |
| 126 | + Please be aware that some editors (like e.g. `VIM`) create temporary files |
| 127 | + when opening files for editing. This will not be detected as a change to the |
| 128 | + actual file and thus not trigger a re-rendering. |
0 commit comments