docs: show beta directive (#25013)

![Screenshot 2024-08-02 at 7 15 34
PM](https://github.com/user-attachments/assets/086831c7-36f3-4962-98dc-d707b6289747)
This commit is contained in:
Bagatur
2024-08-02 20:07:45 -07:00
committed by GitHub
parent e81ddb32a6
commit 1dcee68cb8
4 changed files with 38 additions and 29 deletions

View File

@@ -15,6 +15,8 @@ from pathlib import Path
import toml
from docutils import nodes
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from docutils.statemachine import StringList
from sphinx.util.docutils import SphinxDirective
# If extensions (or modules to document with autodoc) are in another directory,
@@ -66,8 +68,23 @@ class ExampleLinksDirective(SphinxDirective):
return [list_node]
class Beta(BaseAdmonition):
required_arguments = 0
node_class = nodes.admonition
def run(self):
self.content = self.content or StringList(
[
"This feature is in beta. It is actively being worked on, so the API may change."
]
)
self.arguments = self.arguments or ["Beta"]
return super().run()
def setup(app):
app.add_directive("example_links", ExampleLinksDirective)
app.add_directive("beta", Beta)
# -- Project information -----------------------------------------------------

View File

@@ -897,6 +897,13 @@ div.admonition {
background-color: #eee;
}
div.admonition-beta {
color: #d35400; /* A darker rich orange color */
background-color: #FDF2E9; /* A light orange-tinted background color */
border-color: #E59866; /* A darker soft orange border color */
}
div.admonition p:last-child,
div.admonition dl:last-child,
div.admonition dd:last-child,