Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Refactor and update to Documenter v1.0 #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

asinghvi17
Copy link

@asinghvi17 asinghvi17 commented Mar 27, 2024

These changes come mostly from LuxDL/DocumenterVitepress.jl where they are already tested and deployed in several repos. The only new stuff is the inventory writing.

  • Writing methods are updated to use Documenter 1.0 and dispatch on markdown flavors defined by settings
  • MIME rendering is changed to method based dispatch on render_mime for more control and flexibility
  • New Markdown renderer types defined
  • Skeletons for inventory.jl

TODO:

  • Make sure that inventory file writing works
  • Fix up the docs-block format (do we want docs blocks in quotes?). They are currently encased in an HTML div.
  • Test with Documenter extensions
  • Test flavors

asinghvi17 and others added 5 commits March 27, 2024 16:10
- Writing methods are updated to use Documenter 1.0 and dispatch on markdown flavors defined by settings
- MIME rendering is changed to method based dispatch on `render_mime` for more control and flexibility
- New Markdown renderer types defined
- Skeletons for inventory.jl

Co-authored-by: Avik Pal <avikpal@mit.edu>
Co-authored-by: Roger Luo <rogerluo.rl18@gmail.com>
This is sort of type piracy...it creates a struct, which parallels the fields of `Documenter.HTMLContext` that we care about.

No behaviour in Documenter changes but the function is vulnerable to changes in Documenter internals.
# * current working directory is the root directory of the project ("DocInventories") in this case
# * the documentation for the project has been built locally in `docs/build/`
# * the documentation has also been deployed online and is available at the `root_url` hard-coded in the script. Otherwise, do not call `check_url`
# * running on Unix (otherwise: adjust that path separator)
Copy link
Member

Choose a reason for hiding this comment

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

"Unix" isn't going to hold if for testing on Windows CI

test/example/test_inventory.jl Show resolved Hide resolved
test/example/test_inventory.jl Show resolved Hide resolved
@asinghvi17
Copy link
Author

Asking for comments here - is there a particular style people prefer, as a baseline, for docs-blocks in markdown? Currently they're wrapped in an HTML div, but there are other options.

@goerz
Copy link
Member

goerz commented Apr 2, 2024

Currently they're wrapped in an HTML div

As long as that div has a descriptive class name so that these blocks can be addressed by CSS, that seems fine

but there are other options.

What are the other options?

@asinghvi17
Copy link
Author

asinghvi17 commented Apr 2, 2024

I can add the class name, good point!

Our other options are to go "pure Markdown" with the function name being a 6th-order heading, and the docs being separated by horizontal separators.

I guess one can always provide functions to do both...

@goerz
Copy link
Member

goerz commented Apr 2, 2024

I'd go with HTML for the time being. At least until a situation comes up where any of these markdown formats ultimately get processed to something other than HTML/Epub.

Pure markdown has very limited semantics, though, so I'm not sure it would be reasonable to render docstrings that way. If anything, I would render them as a code block; but then that's not really what you want in Vitepress, so then you'd have another step translating that code block into HTML. That doesn't seem like a good idea.

@asinghvi17
Copy link
Author

That's what the dispatch is for ;) - we can have them render in one way for "pure Markdown", and Vitepress can opt to change the particular rendering of docstrings without having to opt out of the whole render tree.

@abogdanov85
Copy link

Hi guys! Wrapping docstrings in code blocks is not a good idea because the content of a single docstring can be really rich and full of different markdown objects like headers, code blocks and even horizontal lines I suppose. So for separating docstrings it would be great to use some kind of commented special text (so that it cannot be seen after render by default). As long as Markdown doesn't support any real comments I suggested this option for separators:

[//]: # (End of docstring)

I searched what people use instead of comments in Markdown and found this as quite common syntax as analogue of commented line.

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.

None yet

3 participants