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

[Docs for engineering] Create a python script to update tagged docs with admonition #3576

Open
stichbury opened this issue Jan 30, 2024 · 4 comments
Labels
Component: Documentation 📄 Issue/PR for markdown and API documentation

Comments

@stichbury
Copy link
Contributor

stichbury commented Jan 30, 2024

Extends #3547

I'd like us to have something along the lines that I've created on this branch using sphinx-tags but without all the overhead of the actual tags in the toctree as we don't need that. Instead I'd like to have a simple way to mark up a docs page with these options:

  • a warning "This doc may need revision" + Link to GitHub issue or
  • a danger sign "We know there are problems in this doc" + Link to GitHub issue

See the prototype-docs-tagging branch for the mockup and the sphinx-tags repo and docs for details.

Using both tags at once to illustrate:
image

We do not need:

  • page in toctree that lists all the tags used
  • pages in the toctree for each of the tags (but to clarify, it would be helpful to be able to build a list of pages using each tag, just not publish them in the toctree alongside those docs)
  • links in docs pages from the tag where it's used to the pages above

We do need:

  • option for colours
  • option for custom text in tag
  • option for link to GitHub in tag
@astrojuanlu
Copy link
Member

Is this essentially admonitions? Like

``` {warning}
We also have legacy documentation pages for the following deployment targets, but these have not been tested against recent Kedro releases and we cannot guarantee them:
* for [Argo Workflows](argo.md)
* for [AWS Batch](aws_batch.md)
```

Rendered:

image

@stichbury
Copy link
Contributor Author

It is but it isn't. We've used those in the absence of anything better right now.

(a) I don't want it to look like the content admonitions: this is a meta level about the docs rather than about Kedro usage. Also it makes it hard to find just the admonitions about docs content when they're formatted like everything else, which leads to the second point...

(b) I want a way to gather together all the docs warnings/danger tags so the team can easily list which pages are problematic. Hence the use of the tags extension (but ideally we don't display the page in the toctree -- I've excluded it in my prototype for a reason)

Does that make sense?

@astrojuanlu
Copy link
Member

Proposed syntax:

---
doctags:
  warning: This page needs update. See [#2825](https://github.com/kedro-org/kedro/issues/2825) for details
---

# Title

Content...

(doctags name bikesheddable)

This uses YAML frontmatter to assign key-value page-wide metadata https://myst-parser.readthedocs.io/en/latest/configuration.html#frontmatter-local-configuration

How to check the metadata in code:

https://github.com/sphinx-doc/sphinx/blob/fa290049515c38e68edda7e8c17be69b8793bb84/sphinx/builders/html/__init__.py#L941-L942

As an inspiration, it's what the ablog extension uses to detect blog posts:

https://ablog.readthedocs.io/en/stable/manual/markdown.html

It uses a barely documented feature called "Sphinx transforms" https://github.com/sunpy/ablog/blob/de37cf013846ceccae0e9e478f4ed6e1bd2dd0d3/src/ablog/post.py#L183 (configured in https://github.com/sunpy/ablog/blob/de37cf013846ceccae0e9e478f4ed6e1bd2dd0d3/src/ablog/__init__.py#L150)

How to create a custom node: https://www.sphinx-doc.org/en/master/development/tutorials/todo.html#writing-the-extension

The styling would be done entirely on CSS.

@astrojuanlu
Copy link
Member

OTOH, https://github.com/melissawm/sphinx-tags/ (the original extension @stichbury tried) is mostly there, save for melissawm/sphinx-tags#97. So an alternative would be to fork it and tweak it to our needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation 📄 Issue/PR for markdown and API documentation
Projects
Status: No status
Development

No branches or pull requests

2 participants