docs icon indicating copy to clipboard operation
docs copied to clipboard

Improve appended toctrees for children

Open dvdmc opened this issue 8 months ago • 1 comments

🦟 Bug fix

No issue oppened

Summary

When creating a doc file with children, if the user writing forgets to add a break at the end of the file, the toctree is not separated from the text.

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

dvdmc avatar Mar 28 '25 01:03 dvdmc

Sure! I will exemplify the steps to reproduce here:

  • If the .md of a page that has children has a break at the end as in this example: https://github.com/gazebosim/docs/blob/a574980d6aa853ac52af0a03f02f2e08d345fa89/harmonic/tutorials.md?plain=1#L49

The end of the intermediate file generated in the .tmp/harmonic/tutorials.md will look like this (without the \ before the `):

[Rest of the file]
- [Utils](/api/utils/2/tutorials.html){.external}
- [Sdformat](/api/sdformat/13/){.external} <- Here there is a break in the original tutorials.md file
\```{toctree}
:hidden:
:maxdepth: 1
:titlesonly:
Building your own robot <building_robot>
Moving the robot <moving_robot>
SDF worlds <sdf_worlds>
Sensors <sensors>
Actors <actors>
Understanding the GUI <gui>
Manipulating Models <manipulating_models>
Model Insertion from Fuel <fuel_insert>
Keyboard Shortcuts <hotkeys>
Spawn URDF <spawn_urdf>
\```

  • However, if the .md has not a break at the end, the generated file looks like:
[Rest of the file]
- [Utils](/api/utils/2/tutorials.html){.external}
- [Sdformat](/api/sdformat/13/){.external} \```{toctree}
:hidden:
:maxdepth: 1
:titlesonly:
Building your own robot <building_robot>
Moving the robot <moving_robot>
SDF worlds <sdf_worlds>
Sensors <sensors>
Actors <actors>
Understanding the GUI <gui>
Manipulating Models <manipulating_models>
Model Insertion from Fuel <fuel_insert>
Keyboard Shortcuts <hotkeys>
Spawn URDF <spawn_urdf>
\```

which messes up the whole toctree affecting the resulting web template.

Leaving additional spaces is not a problem.

dvdmc avatar Mar 29 '25 12:03 dvdmc