diff --git a/doc/Makefile b/doc/Makefile index e1dd82d59cb6ec6..93d5761e75cee92 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -4,7 +4,7 @@ BUILDDIR ?= _build DOC_TAG ?= development -SPHINXOPTS ?= -j auto -W --keep-going -T +SPHINXOPTS ?= -j auto --keep-going -T SPHINXOPTS_EXTRA ?= LATEXMKOPTS ?= -halt-on-error -no-shell-escape DT_TURBO_MODE ?= 0 diff --git a/doc/_extensions/zephyr/domain.py b/doc/_extensions/zephyr/domain.py index df79951a50602b7..23ce6022459fbfe 100644 --- a/doc/_extensions/zephyr/domain.py +++ b/doc/_extensions/zephyr/domain.py @@ -30,6 +30,31 @@ Blink an LED forever using the GPIO API. ``` +- ``zephyr:code-sample-category::`` - Defines a category for grouping code samples. + The directive takes the category name as the main argument, and accepts the following options: + + - ``:id:`` - A unique identifier for the category. (required) + - ``:show-listing:`` - A flag to show a listing of code samples in the category. The listing is + automatically generated based on *all* code samples found in the subdirectories of the current + document. The listing is sorted alphabetically by the name of the code sample. + + The content of the directive is used as the description of the category. It can contain any + valid reStructuredText content. + + Example: + + ``` + .. zephyr:code-sample-category:: Video + :id: video + :show-listing: + + Samples related to :ref:`video` subsystem. + + - ``zephyr:code-sample-listing::`` - A directive that shows a listing of all code samples found in + given categories. The directive takes the following options: + + - ``:categories:`` - A space-separated list of category IDs for which to show the listing. + Roles ----- @@ -46,23 +71,33 @@ ``` """ + +from os import path from typing import Any, Dict, Iterator, List, Tuple from docutils import nodes -from docutils.nodes import Node +from docutils.nodes import Node, system_message from docutils.parsers.rst import Directive, directives from sphinx import addnodes +from sphinx.application import Sphinx from sphinx.domains import Domain, ObjType +from sphinx.environment import BuildEnvironment +from sphinx.environment.collectors import EnvironmentCollector from sphinx.roles import XRefRole from sphinx.transforms import SphinxTransform from sphinx.transforms.post_transforms import SphinxPostTransform from sphinx.util import logging +from sphinx.util.docutils import SphinxDirective, SphinxRole from sphinx.util.nodes import NodeMatcher, make_refnode from zephyr.doxybridge import DoxygenGroupDirective from zephyr.gh_utils import gh_link_get_url import json +import sphinx + +from anytree import Node, Resolver, RenderTree, ChildResolverError, PreOrderIter, search + __version__ = "0.1.0" logger = logging.getLogger(__name__) @@ -76,6 +111,14 @@ class RelatedCodeSamplesNode(nodes.Element): pass +class CodeSampleCategoryNode(nodes.Element): + pass + + +class CodeSampleListingNode(nodes.Element): + pass + + class ConvertCodeSampleNode(SphinxTransform): default_priority = 100 @@ -83,6 +126,9 @@ def apply(self): matcher = NodeMatcher(CodeSampleNode) for node in self.document.traverse(matcher): self.convert_node(node) + # # samples are never considered orphaned + # env = self.document.settings.env + # env.note_included(env.doc2path(env.docname)) def convert_node(self, node): """ @@ -164,6 +210,185 @@ def convert_node(self, node): node.document += json_ld +class ConvertCodeSampleCategoryNode(SphinxTransform): + default_priority = 100 + + def apply(self): + matcher = NodeMatcher(CodeSampleCategoryNode) + for node in self.document.traverse(matcher): + self.convert_node(node) + # # sample categories are never considered orphaned + # env = self.document.settings.env + # env.note_included(env.doc2path(env.docname)) + + def convert_node(self, node): + """ + Transforms a `CodeSampleCategoryNode` into a `nodes.section` named after the category name. + Opt + """ + # new_section = nodes.section(ids=[f"{node['id']}"]) + # new_section += nodes.title(text=node["name"]) + + container = nodes.container() + + container += node["description"] + + if node["show-listing"]: + listing_node = CodeSampleListingNode() + listing_node["categories"] = [node["id"]] + container += listing_node + + node.replace_self(container) + + +class ProcessCodeSampleListingNode(SphinxPostTransform): + default_priority = 5 # needs to run before ReferencesResolver + + def output_sample_categories_sections(self, tree, container: nodes.Node, show_titles=False): + if show_titles: + section = nodes.section(ids=[tree.category["id"]]) + section += nodes.title(text=tree.category["name"]) + container += section + else: + section = container + + # list samples from this category + dl = create_code_sample_definition_list( + [ + code_sample + for code_sample in self.env.domaindata["zephyr"]["code-samples"].values() + if code_sample.get("category") == tree.category["id"] + ] + ) + dl["classes"].append("code-sample-listing") + section += dl + + # sort children by name + sorted_children = sorted(tree.children, key=lambda x: x.name) + for child in sorted_children: + self.output_sample_categories_sections(child, section, show_titles=True) + + def output_sample_categories_list_items(self, tree, container: nodes.Node): + list_item = nodes.list_item() + compact_paragraph = addnodes.compact_paragraph() + # find docname for tree.category["id"] + docname = self.env.domaindata["zephyr"]["code-samples-categories"][tree.category["id"]][ + "docname" + ] + reference = nodes.reference( + "", + "", + internal=True, + refuri=docname, + anchorname="", + *[nodes.Text(tree.category["name"])], + ) + compact_paragraph += reference + list_item += compact_paragraph + + sorted_children = sorted(tree.children, key=lambda x: x.category["name"]) + + # add bullet list for children (if there are any) + if sorted_children: + bullet_list = nodes.bullet_list() + for child in sorted_children: + self.output_sample_categories_list_items(child, bullet_list) + list_item += bullet_list + + container += list_item + + def run(self, **kwargs: Any) -> None: + matcher = NodeMatcher(CodeSampleListingNode) + resolver = Resolver("name") + + for node in self.document.traverse(matcher): + code_samples_categories = self.env.domaindata["zephyr"]["code-samples-categories"] + code_samples_categories_tree = self.env.domaindata["zephyr"][ + "code-samples-categories-tree" + ] + + container = nodes.container() + + try: + print(f"patching toc for doc {self.env.docname}") + print(f"toc before patch = {self.env.tocs[self.env.docname]}") + + # if "self.env.tocs[self.env.docname][0][1]" does not exist, make it a bullet list + if self.env.tocs[self.env.docname][0].__len__() < 2: + self.env.tocs[self.env.docname][0] += nodes.bullet_list() + + toc_segment_to_patch = self.env.tocs[self.env.docname][0][1] + # clear contents of the toc segment + toc_segment_to_patch.clear() + + for category in node["categories"]: + if category not in code_samples_categories: + logger.warning( + f"Category {category} not found in code samples categories", + location=(self.env.docname, node.line), + ) + continue + + category_node = search.find( + code_samples_categories_tree, lambda node: node.category["id"] == category + ) + self.output_sample_categories_sections(category_node, container) + + # patch toc + first_level_categories = [ + n for n in category_node.children if hasattr(n, "category") + ] + + first_level_categories = sorted( + first_level_categories, key=lambda x: x.category["name"] + ) + + for category in first_level_categories: + self.output_sample_categories_list_items(category, toc_segment_to_patch) + + print( + f"new patched toc for doc {self.env.docname}: {self.env.tocs[self.env.docname]}" + ) + + node.replace_self(container) + + except Exception as e: + print(f"error: {e}") + + +def create_code_sample_definition_list(code_samples): + """ + Creates a definition list (`nodes.definition_list`) of code samples from a list of code sample. + + The definition list is sorted alphabetically by the name of the code sample. + The "term" is set to the name of the code sample, and the "definition" is set to its + description. + """ + + dl = nodes.definition_list() + + for code_sample in sorted(code_samples, key=lambda x: x["name"].casefold()): + term = nodes.term() + + sample_xref = addnodes.pending_xref( + "", + refdomain="zephyr", + reftype="code-sample", + reftarget=code_sample["id"], + refwarn=True, + ) + sample_xref += nodes.inline(text=code_sample["name"]) + term += sample_xref + definition = nodes.definition() + definition += nodes.paragraph(text=code_sample["description"].astext()) + sample_dli = nodes.definition_list_item() + sample_dli += term + sample_dli += definition + dl += sample_dli + + return dl + + class ProcessRelatedCodeSamplesNode(SphinxPostTransform): default_priority = 5 # before ReferencesResolver @@ -183,30 +408,11 @@ def run(self, **kwargs: Any) -> None: admonition = nodes.admonition() admonition += nodes.title(text="Related code samples") admonition["classes"].append("related-code-samples") - admonition["classes"].append("dropdown") # used by sphinx-togglebutton extension - admonition["classes"].append("toggle-shown") # show the content by default - - sample_dl = nodes.definition_list() + admonition["classes"].append("dropdown") # used by sphinx-togglebutton extension + admonition["classes"].append("toggle-shown") # show the content by default - for code_sample in sorted(code_samples, key=lambda x: x["name"]): - term = nodes.term() - - sample_xref = addnodes.pending_xref( - "", - refdomain="zephyr", - reftype="code-sample", - reftarget=code_sample["id"], - refwarn=True, - ) - sample_xref += nodes.inline(text=code_sample["name"]) - term += sample_xref - definition = nodes.definition() - definition += nodes.paragraph(text=code_sample["description"].astext()) - sample_dli = nodes.definition_list_item() - sample_dli += term - sample_dli += definition - sample_dl += sample_dli - admonition += sample_dl + samples_dl = create_code_sample_definition_list(code_samples) + admonition += samples_dl # replace node with the newly created admonition node.replace_self(admonition) @@ -265,6 +471,100 @@ def run(self): return [code_sample_node] +class CodeSampleCategoryDirective(SphinxDirective): + required_arguments = 1 # Category name + optional_arguments = 0 + option_spec = { + "name": directives.unchanged, + "show-listing": directives.flag, + } + has_content = True # Category description + final_argument_whitespace = True + + def run(self): + + print(f"CodeSampleCategoryDirective found at line {self.lineno}") + + env = self.state.document.settings.env + id = self.arguments[0] + name = self.options.get("name", id) + + # force document title to be the category name + self.state.document["title"] = name + + category_node = CodeSampleCategoryNode() + category_node["id"] = id + category_node["name"] = name + category_node["docname"] = env.docname + category_node["show-listing"] = "show-listing" in self.options + + description_node = self.parse_content_to_nodes() + category_node["description"] = description_node + + code_sample_category = { + "docname": env.docname, + "id": id, + "name": name, + } + + # Add the category to the domain + domain = env.get_domain("zephyr") + domain.add_code_sample_category(code_sample_category) + + # add fake text input representing a toc to make sure subcategories are added to the toc + lines = [] + lines.append(name) + lines.append("=" * len(name)) + lines.append("") + lines.append(".. toctree::") + lines.append(".. toctree::") + lines.append(" :titlesonly:") + lines.append(" :glob:") + lines.append(" :hidden:") + lines.append(" :maxdepth: 1") + lines.append("") + lines.append(" */*") + lines.append("") + + self.state_machine.insert_input(lines, "__generated__") + + new_section = nodes.section(ids=[id]) + new_section += nodes.title(text=name) + new_section += category_node + + return [category_node] +# return [new_section] + + +class CodeSampleListingDirective(SphinxDirective): + """ + A directive that automatically shows a listing of all code samples found in the subdirectories + of the current document. + + The toc is hidden, and only exists for the purpose of generating an alphabetically sorted + list of code samples in the sidebar. + + """ + + has_content = False + required_arguments = 0 + optional_arguments = 0 + option_spec = { + "categories": directives.unchanged_required, + "depth": directives.nonnegative_int, + } + + def run(self): + print("CodeSampleListingDirective") + env = self.state.document.settings.env + + code_sample_listing_node = CodeSampleListingNode() + code_sample_listing_node["categories"] = self.options.get("categories").split() + code_sample_listing_node["depth"] = self.options.get("depth", 1) + + return [code_sample_listing_node] + + class ZephyrDomain(Domain): """Zephyr domain""" @@ -273,15 +573,53 @@ class ZephyrDomain(Domain): roles = { "code-sample": XRefRole(innernodeclass=nodes.inline, warn_dangling=True), + "code-sample-category": XRefRole(innernodeclass=nodes.inline, warn_dangling=True), } - directives = {"code-sample": CodeSampleDirective} + directives = { + "code-sample": CodeSampleDirective, + "code-sample-listing": CodeSampleListingDirective, + "code-sample-category": CodeSampleCategoryDirective, + } object_types: Dict[str, ObjType] = { "code-sample": ObjType("code-sample", "code-sample"), } - initial_data: Dict[str, Any] = {"code-samples": {}} + initial_data: Dict[str, Any] = { + "code-samples": {}, # id -> code sample data + "code-samples-categories": {}, # id -> code sample category data + "code-samples-categories-tree": Node("samples"), + } + + def add_category_to_tree( + self, category_path: str, category_id: str, category_name: str + ) -> Node: + resolver = Resolver("name") + tree = self.data["code-samples-categories-tree"] + + if not category_path.startswith("/"): + category_path = "/" + category_path + + try: + # Try to get the node at the specified path + node = resolver.get(tree, category_path) + except ChildResolverError as e: + path_of_last_existing_node = "/" + "/".join([n.name for n in e.node.path]) + + common_path = path.commonpath([path_of_last_existing_node, category_path]) + remaining_path = path.relpath(category_path, common_path) + + # Add missing nodes under the last existing node + for node_name in remaining_path.split("/"): + e.node = Node(node_name, parent=e.node) + + node = e.node + + # Assign the category to the final node + node.category = {"id": category_id, "name": category_name} + + return tree def clear_doc(self, docname: str) -> None: self.data["code-samples"] = { @@ -290,8 +628,26 @@ def clear_doc(self, docname: str) -> None: if sample_data["docname"] != docname } + self.data["code-samples-categories"] = { + category_id: category_data + for category_id, category_data in self.data["code-samples-categories"].items() + if category_data["docname"] != docname + } + + # TODO remove category from tree as well + def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: self.data["code-samples"].update(otherdata["code-samples"]) + self.data["code-samples-categories"].update(otherdata["code-samples-categories"]) + + # merge category trees + other_tree = otherdata["code-samples-categories-tree"] + categories = [n for n in PreOrderIter(other_tree) if hasattr(n, "category")] + for category in categories: + category_path = "/" + "/".join([n.name for n in category.path]) + self.add_category_to_tree( + category_path, category.category["id"], category.category["name"] + ) def get_objects(self): for _, code_sample in self.data["code-samples"].items(): @@ -314,23 +670,36 @@ def get_object_synopses(self) -> Iterator[Tuple[Tuple[str, str], str]]: def resolve_xref(self, env, fromdocname, builder, type, target, node, contnode): if type == "code-sample": - code_sample_info = self.data["code-samples"].get(target) - if code_sample_info: - if not node.get("refexplicit"): - contnode = [nodes.Text(code_sample_info["name"])] - - return make_refnode( - builder, - fromdocname, - code_sample_info["docname"], - code_sample_info["id"], - contnode, - code_sample_info["description"].astext(), - ) + elem = self.data["code-samples"].get(target) + elif type == "code-sample-category": + elem = self.data["code-samples-categories"].get(target) + else: + return + + if elem: + if not node.get("refexplicit"): + contnode = [nodes.Text(elem["name"])] + + return make_refnode( + builder, + fromdocname, + elem["docname"], + elem["id"], + contnode, + elem["description"].astext() if type == "code-sample" else None, + ) def add_code_sample(self, code_sample): self.data["code-samples"][code_sample["id"]] = code_sample + def add_code_sample_category(self, code_sample_category): + self.data["code-samples-categories"][code_sample_category["id"]] = code_sample_category + self.add_category_to_tree( + path.dirname(code_sample_category["docname"]), + code_sample_category["id"], + code_sample_category["name"], + ) + class CustomDoxygenGroupDirective(DoxygenGroupDirective): """Monkey patch for Breathe's DoxygenGroupDirective.""" @@ -344,14 +713,38 @@ def run(self) -> List[Node]: return nodes +def compute_sample_categories_hierarchy(app: Sphinx, env: BuildEnvironment) -> None: + domain = env.get_domain("zephyr") + code_samples = domain.data["code-samples"] + + category_tree = env.domaindata["zephyr"]["code-samples-categories-tree"] + resolver = Resolver("name") + for code_sample in code_samples.values(): + try: + # Try to get the node at the specified path + node = resolver.get(category_tree, "/" + path.dirname(code_sample["docname"])) + except ChildResolverError as e: + # starting with e.node and up, find the first node that has a category + node = e.node + while not hasattr(node, "category"): + node = node.parent + code_sample["category"] = node.category["id"] + + print(RenderTree(category_tree)) + def setup(app): app.add_config_value("zephyr_breathe_insert_related_samples", False, "env") app.add_domain(ZephyrDomain) app.add_transform(ConvertCodeSampleNode) + app.add_transform(ConvertCodeSampleCategoryNode) + + app.add_post_transform(ProcessCodeSampleListingNode) app.add_post_transform(ProcessRelatedCodeSamplesNode) + app.connect("env-updated", compute_sample_categories_hierarchy) + # monkey-patching of the DoxygenGroupDirective app.add_directive("doxygengroup", CustomDoxygenGroupDirective, override=True) diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css index 97a00d9e2c1b9b8..52426a6e5a5e0a2 100644 --- a/doc/_static/css/custom.css +++ b/doc/_static/css/custom.css @@ -37,6 +37,7 @@ legend, .rst-content .toctree-wrapper p.caption { /* Use a lighter font for headers (Medium instead of Bold) */ font-weight: 500; + font-family: "Oswald", "Montserrat", "Poppins", "Roboto Condensed", "Segoe UI Bold", "Arial Black", sans-serif } .rst-content div.figure p.caption { @@ -606,78 +607,139 @@ kbd, .kbd, opacity: 0.9; } -/* First level of navigation items */ +/* Default styling of navigation items */ -.wy-menu-vertical a { +.wy-menu-vertical li { + background-color: var(--navbar-background-color); +} + +.wy-menu-vertical li.current { + background-color: var(--navbar-current-background-color); +} + +.wy-menu-vertical li>a { color: var(--navbar-level-1-color); + font-size: 92%; + line-height: 20px; + padding: .4045em 1.618em; } -.wy-menu-vertical a:hover { +.wy-menu-vertical li>a:hover { background-color: var(--navbar-background-color-hover); color: var(--navbar-level-1-color); } - -.wy-menu-vertical a:active { +.wy-menu-vertical li>a:active { background-color: var(--navbar-background-color-active); } -.wy-menu-vertical li.toctree-l1.current > a { - border: none; -} - -.wy-side-nav-search, .wy-menu-vertical a, .wy-menu-vertical a span.toctree-expand, -.wy-menu-vertical li.toctree-l2 a span.toctree-expand { - color: var(--navbar-level-3-color); +.wy-menu-vertical li>a button.toctree-expand { + color: var(--navbar-expand-base-color) !important; opacity: 0.9; margin-right: 8px; +/* Make the expand icon a bit easier to hit. */ + position: relative; + width: 12px; + min-width: 12px; + /* Forces the size to stay this way in the flexbox model. */ + height: 18px; } -.wy-side-nav-search, .wy-menu-vertical a, .wy-menu-vertical a:hover span.toctree-expand, -.wy-menu-vertical li.toctree-l2 a:hover span.toctree-expand { - color: var(--navbar-level-2-color); - opacity: 1; +.wy-menu-vertical li.current>a button.toctree-expand { + color: var(--navbar-current-color) !important; } -.wy-side-nav-search, .wy-menu-vertical a, .wy-menu-vertical a:active span.toctree-expand, -.wy-menu-vertical li.toctree-l2 a:active span.toctree-expand { - color: var(--navbar-level-1-color); +.wy-menu-vertical li>a:hover button.toctree-expand { + color: var(--navbar-expand-hover-color) !important; + opacity: 1; +} +.wy-menu-vertical li>a:active button.toctree-expand { + color: var(--navbar-expand-active-color) !important; opacity: 1; } -/* Second (and higher) levels of navigation items */ +/* Make the expand icon a bit easier to hit. */ +.wy-menu-vertical li>a button.toctree-expand:before { + position: absolute; + top: -2px; + left: -6px; + width: 24px; + height: 24px; + padding: 6px; +} + +.wy-menu-vertical li.current>a, +.wy-menu-vertical li.toctree-l2.current>a { + background-color: var(--navbar-current-background-color-hover); + border-bottom: 2px solid var(--navbar-current-background-color); + color: var(--navbar-current-color); + font-weight: 600; -.wy-menu-vertical li.current a { /* Make long words always display on a single line, keep wrapping for multiple words */ /* This fixes the class reference titles' display with very long class names */ display: flex; } +.wy-menu-vertical li.current>a:hover, +.wy-menu-vertical li.toctree-l2.current>a:hover { + background-color: var(--navbar-current-background-color-hover); +} + +.wy-menu-vertical li.current>a:active, +.wy-menu-vertical li.toctree-l2.current>a:active { + background-color: var(--navbar-current-background-color-active); +} + +/* Slightly adjust first level items. */ +.wy-menu-vertical li.toctree-l1>a, +.wy-menu-vertical li.toctree-l1.current>a { + border: none; + padding: .4045em 1.918em; +} + +.wy-menu-vertical li.toctree-l1.current>a { + border-bottom: 2px solid var(--navbar-current-background-color); +} -.wy-menu-vertical li.current a, -.wy-menu-vertical li.toctree-l2.current > a, +/* Override styling for children of the current item. */ +.wy-menu-vertical li.current li>a, +.wy-menu-vertical li.toctree-l2.current li>a, .wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a, .wy-menu-vertical li.toctree-l2.current li.toctree-l4 > a { background-color: var(--navbar-current-background-color); + border: none; + border-bottom: 2px solid var(--navbar-current-background-color); color: var(--navbar-level-2-color); - border-color: var(--navbar-current-background-color); } - -.wy-menu-vertical li.current a:hover, -.wy-menu-vertical li.toctree-l2.current > a:hover, +.wy-menu-vertical li.current li>a:hover, +.wy-menu-vertical li.toctree-l2.current li>a:hover, .wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a:hover, -.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a:hover { +.wy-menu-vertical li.toctree-l2.current li.toctree-l4>a:hover { background-color: var(--navbar-current-background-color-hover); } - -.wy-menu-vertical li.current a:active, -.wy-menu-vertical li.toctree-l2.current > a:active, +.wy-menu-vertical li.current li>a:active, +.wy-menu-vertical li.toctree-l2.current li>a:active, .wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a:active, -.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a:active { +.wy-menu-vertical li.toctree-l2.current li.toctree-l4>a:active { background-color: var(--navbar-current-background-color-active); } -.wy-menu-vertical a { - /* This overrides 8px margin added in other multi-selector rules */ - margin-right: 0; +.wy-menu-vertical li.toctree-l2.current li>a, +.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a, +.wy-menu-vertical li.toctree-l2.current li.toctree-l4>a { + color: var(--navbar-level-3-color); +} + +.wy-menu-vertical li.toctree-l2.current li>a:hover, +.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a:hover, +.wy-menu-vertical li.toctree-l2.current li.toctree-l4>a:hover { + color: var(--navbar-level-1-color); +} + +.wy-menu-vertical li.current li.current>a, +.wy-menu-vertical li.toctree-l2.current li.current>a, +.wy-menu-vertical li.toctree-l2.current li.toctree-l3.current>a, +.wy-menu-vertical li.toctree-l2.current li.toctree-l4.current>a { + color: var(--navbar-current-color); + font-weight: 600; } /* Banner panel in sidebar */ @@ -964,4 +1026,9 @@ dark-mode-toggle::part(toggleLabel){ margin-left: 8px; font-size: 0.875em; font-weight: bold; +} +.code-sample-listing { + display: grid; + grid-template-columns: 30% 70%; + gap: 0px; } \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 5b0f2959261b78f..58fbc547c06c533 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -160,7 +160,8 @@ html_theme = "sphinx_rtd_theme" html_theme_options = { "logo_only": True, - "prev_next_buttons_location": None + "prev_next_buttons_location": None, + "navigation_depth": 7, } html_baseurl = "https://docs.zephyrproject.org/latest/" html_title = "Zephyr Project Documentation" diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst index 052f038302cab0b..49897bede2434f6 100644 --- a/doc/contribute/documentation/guidelines.rst +++ b/doc/contribute/documentation/guidelines.rst @@ -7,7 +7,7 @@ Documentation Guidelines .. note:: - For instructions on building the documentation, see :ref:`zephyr_doc`. + xxxFor instructions on building the documentation, see :ref:`zephyr_doc`. Zephyr Project content is written using the `reStructuredText`_ markup language (.rst file extension) with Sphinx extensions, and processed diff --git a/doc/develop/api/index.rst b/doc/develop/api/index.rst index d22cc1f1b31b2a4..deef4eb25cdaf0e 100644 --- a/doc/develop/api/index.rst +++ b/doc/develop/api/index.rst @@ -3,6 +3,9 @@ API Status and Guidelines ######################### +Heading 1 +========= + .. toctree:: :maxdepth: 1 diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 0332c9879ec8311..9842b4284347fad 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -11,6 +11,10 @@ Follow this guide to: - Get the source code - Build, flash, and run a sample application +xxx + +xxx + .. _host_setup: Select and Update OS diff --git a/doc/requirements.txt b/doc/requirements.txt index aa77efa604fd7f9..66ffa4f6580495c 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -21,3 +21,6 @@ pyserial # Doxygen doxmlparser doxmlparser + +# Used by the Zephyr domain to organize code samples +anytree \ No newline at end of file diff --git a/samples/application_development/application_development.rst b/samples/application_development/application_development.rst index f467600d235f52f..01982c37f7e9157 100644 --- a/samples/application_development/application_development.rst +++ b/samples/application_development/application_development.rst @@ -1,16 +1,14 @@ -.. _application-development-samples: +.. zephyr:code-sample-category:: application_development + :name: Application Development + :show-listing: -Application development samples -############################### + These samples illustrate some useful application development patterns and techniques. For application development you should also consider looking at `example-application`_. Among others, you will find on it out of tree driver or board examples. -.. toctree:: - :maxdepth: 1 - :glob: +.. _example-application: https://github.com/zephyrproject-rtos/example-application - **/* -.. _example-application: https://github.com/zephyrproject-rtos/example-application +x \ No newline at end of file diff --git a/samples/basic/basic.rst b/samples/basic/basic.rst index d40b04527aca05b..7985892834cdda0 100644 --- a/samples/basic/basic.rst +++ b/samples/basic/basic.rst @@ -1,10 +1,5 @@ -.. _basic-sample: +.. zephyr:code-sample-category:: basic + :name: Basic + :show-listing: -Basic Samples -############# - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate basic functionality of the Zephyr kernel. diff --git a/samples/bluetooth/bluetooth.rst b/samples/bluetooth/bluetooth.rst index 35b49bfd0abfcd0..f703c01c058d9bb 100644 --- a/samples/bluetooth/bluetooth.rst +++ b/samples/bluetooth/bluetooth.rst @@ -1,7 +1,7 @@ -.. _bluetooth-samples: +.. zephyr:code-sample-category:: bluetooth + :name: Bluetooth -Bluetooth samples -################# + These samples bla bla bluetooth To build any of the Bluetooth samples, follow the same steps as building any other Zephyr application. Refer to :ref:`bluetooth-dev` for more information. @@ -29,8 +29,5 @@ documentation and are prefixed with :literal:`hci_` in their folder names. connections will fail. You can force a re-paring and new key to be created by removing the device from the associated devices list on the host. -.. toctree:: - :maxdepth: 1 - :glob: - - **/* +.. zephyr:code-sample-listing:: + :categories: bluetooth diff --git a/samples/boards/boards.rst b/samples/boards/boards.rst index 146a59fe0874f64..2b7baccc8ee7e59 100644 --- a/samples/boards/boards.rst +++ b/samples/boards/boards.rst @@ -1,10 +1,5 @@ -.. _board-specific-samples: +.. zephyr:code-sample-category:: boards + :name: Board-specific Samples + :show-listing: -Board-specific samples -###################### - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate some board-specific features in Zephyr. diff --git a/samples/boards/esp32/deep_sleep/README.rst b/samples/boards/esp32/deep_sleep/README.rst index ac73969915b3c3f..61fefe225c1914a 100644 --- a/samples/boards/esp32/deep_sleep/README.rst +++ b/samples/boards/esp32/deep_sleep/README.rst @@ -1,3 +1,8 @@ +.. zephyr:code-sample:: esp32-deep-sleep + :name: ESP32 Deep Sleep + + Use deep sleep with wake on timer, GPIO, and EXT1 sources on ESP32. + .. _esp32-deep-sleep-sample: ESP32 Deep Sleep demo diff --git a/samples/boards/esp32/esp32.rst b/samples/boards/esp32/esp32.rst new file mode 100644 index 000000000000000..d2d459f33e54954 --- /dev/null +++ b/samples/boards/esp32/esp32.rst @@ -0,0 +1,5 @@ +.. zephyr:code-sample-category:: esp32 + :name: ESP32 boards + :show-listing: + + Samples that demonstrate the use of Espressif ESP32 boards in Zephyr. diff --git a/samples/boards/stm32/stm32.rst b/samples/boards/stm32/stm32.rst new file mode 100644 index 000000000000000..ca9be2934e200ec --- /dev/null +++ b/samples/boards/stm32/stm32.rst @@ -0,0 +1,5 @@ +.. zephyr:code-sample-category:: stm32 + :name: STM32 boards + :show-listing: + + Samples that demonstrate the use of STM32 boards in Zephyr. diff --git a/samples/classic.rst b/samples/classic.rst deleted file mode 100644 index 707d1a590ebb6e1..000000000000000 --- a/samples/classic.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. _classic_samples: - -Classic Samples -############### - -The following are samples that can be run on any of the supported -platforms: - -.. toctree:: - :maxdepth: 1 - :glob: - - hello_world/* - synchronization/* - philosophers/* diff --git a/samples/classic.xyz b/samples/classic.xyz new file mode 100644 index 000000000000000..9135509372c3a90 --- /dev/null +++ b/samples/classic.xyz @@ -0,0 +1,13 @@ +.. zephyr:code-sample-category:: classic + :name: Classic + :show-listing: + + Samples that can be run on *any* of the supported platforms + +.. toctree:: + :maxdepth: 1 + :glob: + + hello_world/* + synchronization/* + philosophers/* diff --git a/samples/cpp/cpp.rst b/samples/cpp/cpp.rst index aeecebadccad534..4722683a9ee5621 100644 --- a/samples/cpp/cpp.rst +++ b/samples/cpp/cpp.rst @@ -1,10 +1,5 @@ -.. _cpp-samples: +.. zephyr:code-sample-category:: cpp + :name: C++ + :show-listing: -C++ Samples -########### - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to write Zephyr applications in C++. diff --git a/samples/drivers/adc/README.rst b/samples/drivers/adc/README.rst new file mode 100644 index 000000000000000..10f45a2a274579e --- /dev/null +++ b/samples/drivers/adc/README.rst @@ -0,0 +1,10 @@ +.. zephyr:code-sample-category:: adc + :name: ADC + :show-listing: + + These samples demonstrate how to use the :ref:`ADC ` subsystem. + +xxx +xxx + +xxx \ No newline at end of file diff --git a/samples/drivers/audio/audio.rst b/samples/drivers/audio/audio.rst new file mode 100644 index 000000000000000..8401e0572950c8c --- /dev/null +++ b/samples/drivers/audio/audio.rst @@ -0,0 +1,5 @@ +.. zephyr:code-sample-category:: audio + :name: Audio + :show-listing: + + blabla audio \ No newline at end of file diff --git a/samples/drivers/auxdisplay/README.rst b/samples/drivers/auxdisplay/README.rst index 67bfb0e56777bec..09805a0ce4ffeca 100644 --- a/samples/drivers/auxdisplay/README.rst +++ b/samples/drivers/auxdisplay/README.rst @@ -7,6 +7,8 @@ Overview ******** +xxx + This sample shows how to use the :ref:`auxiliary display driver ` by outputting a sample "Hello World" text to one. diff --git a/samples/drivers/drivers.rst b/samples/drivers/drivers.rst index 84c5426094a9d87..1f521875a3a74b5 100644 --- a/samples/drivers/drivers.rst +++ b/samples/drivers/drivers.rst @@ -1,13 +1,5 @@ -.. _driver-samples: +.. zephyr:code-sample-category:: drivers + :name: Drivers + :show-listing: -Driver Samples -############## - -The following samples demonstrate how to use various drivers supported -by Zephyr. - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to use various drivers supported by Zephyr. diff --git a/samples/index.rst b/samples/index.rst index d8f28152c733d46..1e92300e216842c 100644 --- a/samples/index.rst +++ b/samples/index.rst @@ -1,35 +1,7 @@ -.. _samples-and-demos: +.. zephyr:code-sample-category:: samples + :name: Samples and Demos + :show-listing: -Samples and Demos -################# + This is Zephyr all samples - -.. toctree:: - :titlesonly: - :maxdepth: 2 - :glob: - - sample_definition_and_criteria - classic - basic/* - userspace/* - sysbuild/* - subsys/subsys.rst - net/net.rst - bluetooth/bluetooth.rst - sensor/* - arch/* - boards/* - drivers/drivers.rst - application_development/* - shields/* - cpp/* - posix/* - kernel/* - tfm_integration/tfm_integration.rst - modules/* - fuel_gauge/* - -.. comment - To add a new sample document, please use the template available under - ``doc/templates/sample.tmpl`` +xxxx diff --git a/samples/kernel/index.rst b/samples/kernel/index.rst index 13c31ecb31a0a52..dbf393490c0a547 100644 --- a/samples/kernel/index.rst +++ b/samples/kernel/index.rst @@ -1,10 +1,7 @@ -.. _kernel-samples: +.. zephyr:code-sample-category:: kernel + :name: Kernel and Scheduler + :show-listing: -Various Kernel and Scheduler Samples -#################################### + These samples demonstrate how to use various kernel and scheduler features. -.. toctree:: - :maxdepth: 1 - :glob: - - **/* +xx \ No newline at end of file diff --git a/samples/modules/cmsis_dsp/cmsis_dsp.rst b/samples/modules/cmsis_dsp/cmsis_dsp.rst index dce6b8cad961b35..0506721f4e086b3 100644 --- a/samples/modules/cmsis_dsp/cmsis_dsp.rst +++ b/samples/modules/cmsis_dsp/cmsis_dsp.rst @@ -1,12 +1,6 @@ -CMSIS-DSP -######### +.. zephyr:code-sample-category:: cmsis_dsp + :name: CMSIS-DSP + :show-listing: -These samples demonstrate how to use the CMSIS-DSP module to perform signal processing operations -in Zephyr. - -.. toctree:: - :titlesonly: - :glob: - :maxdepth: 1 - - */* + These samples demonstrate how to use the CMSIS-DSP module to perform signal processing operations + in Zephyr. diff --git a/samples/modules/compression/compression.rst b/samples/modules/compression/compression.rst index 9cc3cd3d3c3e0f2..095c326584ef0a0 100644 --- a/samples/modules/compression/compression.rst +++ b/samples/modules/compression/compression.rst @@ -1,10 +1,3 @@ -.. _compression-samples: - -Compression Samples -################### - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* +.. zephyr:code-sample-category:: compression + :name: Compression + :show-listing: diff --git a/samples/modules/index.rst b/samples/modules/index.rst index c40b9fe7850c511..8c5c9b47aa389ec 100644 --- a/samples/modules/index.rst +++ b/samples/modules/index.rst @@ -1,11 +1,5 @@ -.. _module-samples: +.. zephyr:code-sample-category:: modules + :name: External modules + :show-listing: -External Module Samples -####################### - -.. toctree:: - :titlesonly: - :maxdepth: 2 - :glob: - - */* + These samples demonstrate the use of external modules in Zephyr. diff --git a/samples/modules/lvgl/lvgl.rst b/samples/modules/lvgl/lvgl.rst index 736ddd1a00b04ec..e6b82324abe0eb9 100644 --- a/samples/modules/lvgl/lvgl.rst +++ b/samples/modules/lvgl/lvgl.rst @@ -1,13 +1,6 @@ -.. _lvgl_samples: +.. zephyr:code-sample-category:: lvgl + :name: LVGL + :show-listing: -LVGL -#### + These samples demonstrate how to build graphical user interfaces using LVGL in Zephyr. -These samples demonstrate how to build graphical user interfaces using LVGL in Zephyr. - -.. toctree:: - :titlesonly: - :glob: - :maxdepth: 1 - - **/* diff --git a/samples/modules/tflite-micro/tflite-micro.rst b/samples/modules/tflite-micro/tflite-micro.rst index 861618a645b24fe..316791c72710a70 100644 --- a/samples/modules/tflite-micro/tflite-micro.rst +++ b/samples/modules/tflite-micro/tflite-micro.rst @@ -1,13 +1,5 @@ -.. _tflitemicro_samples: +.. zephyr:code-sample-category:: tflite-micro + :name: TensorFlow Lite for Microcontrollers + :show-listing: -TensorFlow Lite for Microcontrollers -#################################### - -These samples demonstrate how to use TensorFlow Lite for Microcontrollers in Zephyr. - -.. toctree:: - :titlesonly: - :glob: - :maxdepth: 1 - - **/* + These samples demonstrate how to use TensorFlow Lite for Microcontrollers in Zephyr. diff --git a/samples/net/cloud/README.rst b/samples/net/cloud/README.rst new file mode 100644 index 000000000000000..1cad4e8e17c8c68 --- /dev/null +++ b/samples/net/cloud/README.rst @@ -0,0 +1,8 @@ +.. zephyr:code-sample-category:: cloud + :name: IoT Cloud + :show-listing: + + These samples demonstrate how to connect Zephyr devices to various IoT cloud services. + + +xxx \ No newline at end of file diff --git a/samples/net/net.rst b/samples/net/net.rst index cbccd04fdf85c83..62c836ee371f511 100644 --- a/samples/net/net.rst +++ b/samples/net/net.rst @@ -1,10 +1,5 @@ -.. _networking-samples: +.. zephyr:code-sample-category:: net + :name: Networking + :show-listing: -Networking Samples -################## - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to use the networking subsystem. diff --git a/samples/net/sockets/sockets.rst b/samples/net/sockets/sockets.rst new file mode 100644 index 000000000000000..d72f02b952c3b04 --- /dev/null +++ b/samples/net/sockets/sockets.rst @@ -0,0 +1,5 @@ +.. zephyr:code-sample-category:: sockets + :name: Sockets API + :show-listing: + + These samples demonstrate how to use the Sockets API xxx. \ No newline at end of file diff --git a/samples/posix/posix.rst b/samples/posix/posix.rst index f7d026eb2cd1256..2e975069b669cdb 100644 --- a/samples/posix/posix.rst +++ b/samples/posix/posix.rst @@ -1,10 +1,5 @@ -.. _posix-samples: +.. zephyr:code-sample-category:: posix + :name: POSIX API + :show-listing: -POSIX API Samples -################# - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to use the :ref:`POSIX API ` in Zephyr. diff --git a/samples/sensor/accel_polling/README.rst b/samples/sensor/accel_polling/README.rst index 15260817f065ca8..3a71699b8b28459 100644 --- a/samples/sensor/accel_polling/README.rst +++ b/samples/sensor/accel_polling/README.rst @@ -1,7 +1,7 @@ -.. _accel_polling: +.. zephyr:code-sample:: accel_polling + :name: Generic 3-Axis accelerometer polling -Generic 3-Axis accelerometer polling sample -########################################### + Get 3-Axis accelerometer data from a sensor using polling. Overview ******** diff --git a/samples/sensor/adc_cmp_npcx/README.rst b/samples/sensor/adc_cmp_npcx/README.rst index 2054ee72c00f0ab..48ee0ac8603bb87 100644 --- a/samples/sensor/adc_cmp_npcx/README.rst +++ b/samples/sensor/adc_cmp_npcx/README.rst @@ -1,7 +1,7 @@ -.. _adc_cmp_npcx: +.. zephyr:code-sample:: adc_cmp_npcx + :name: NPCX ADC Comparator -NPCX ADC Comparator -################### + Use the NPCX ADC Comparator to detect upper/lower voltage limits. Overview ******** diff --git a/samples/sensor/adt7420/README.rst b/samples/sensor/adt7420/README.rst index 86b6ceea8c2019a..781f4b76566a7f1 100644 --- a/samples/sensor/adt7420/README.rst +++ b/samples/sensor/adt7420/README.rst @@ -1,7 +1,7 @@ -.. _adt7420: +.. zephyr:code-sample:: adt7420 + :name: ADT7420 high-accuracy digital I2C temperature sensor -ADT7420: High accuracy digital I2C temperature sensor -##################################################### + Get temperature data from an ADT7420 sensor using polling and window mode. Description *********** diff --git a/samples/sensor/amg88xx/README.rst b/samples/sensor/amg88xx/README.rst index 88bf1d96f7d9a19..0eb3a249cf4b73e 100644 --- a/samples/sensor/amg88xx/README.rst +++ b/samples/sensor/amg88xx/README.rst @@ -1,7 +1,7 @@ -.. _amg88xx: +.. zephyr:code-sample:: amg88xx + :name: AMG88XX infrared array sensor -AMG88XX Infrared Array Sensor -############################# + Get temperature data from an AMG88XX 8x8 thermal camera sensor. Overview ******** diff --git a/samples/sensor/ams_iAQcore/README.rst b/samples/sensor/ams_iAQcore/README.rst index 0bc8953d791c8b5..5a838579a05dcd2 100644 --- a/samples/sensor/ams_iAQcore/README.rst +++ b/samples/sensor/ams_iAQcore/README.rst @@ -1,7 +1,7 @@ -.. _ams_iaqcore: +.. zephyr:code-sample:: ams_iaqcore + :name: ams iAQcore indoor air quality sensor -ams iAQcore Indoor air quality sensor -##################################### + Get CO2 equivalent and VOC data from an ams iAQcore sensor. Overview ******** diff --git a/samples/sensor/apds9960/README.rst b/samples/sensor/apds9960/README.rst index e4e371d0bb18c06..1b4d49b75dc7d38 100644 --- a/samples/sensor/apds9960/README.rst +++ b/samples/sensor/apds9960/README.rst @@ -1,3 +1,9 @@ +.. zephyr:code-sample:: apds9960 + :name: APDS9960 RGB, ambient light, and gesture sensor + + Get ambient light, RGB, and proximity/gesture data from an APDS9960 sensor. + + .. _apds9960: APDS9960 RGB, Ambient Light, Gesture Sensor diff --git a/samples/sensor/bme280/README.rst b/samples/sensor/bme280/README.rst index 3d32ae0d4203811..2f0804329649c76 100644 --- a/samples/sensor/bme280/README.rst +++ b/samples/sensor/bme280/README.rst @@ -1,7 +1,7 @@ -.. _bme280: +.. zephyr:code-sample:: bme280 + :name: BME280 humidity and pressure sensor -BME280 Humidity and Pressure Sensor -################################### + Get temperature, pressure, and humidity data from a BME280 sensor. Overview ******** diff --git a/samples/sensor/bmi270/README.rst b/samples/sensor/bmi270/README.rst index d638549258d2ab5..253433aff2f58ff 100644 --- a/samples/sensor/bmi270/README.rst +++ b/samples/sensor/bmi270/README.rst @@ -1,7 +1,7 @@ -.. _bmi270: +.. zephyr:code-sample:: bmi270 + :name: BMI270 6-axis IMU sensor -BMI270: 6 axis inertial measurement unit -######################################## + Configure and read accelerometer and gyroscope data from a BMI270 sensor. Description *********** diff --git a/samples/sensor/bq274xx/README.rst b/samples/sensor/bq274xx/README.rst index 43aee628b18d567..04477a7fbb09a1f 100644 --- a/samples/sensor/bq274xx/README.rst +++ b/samples/sensor/bq274xx/README.rst @@ -1,7 +1,7 @@ -.. _bq274xx-sample: +.. zephyr:code-sample:: bq274xx + :name: BQ274XX fuel gauge sensor -BQ274XX Sensor Sample -##################### + Get various fuel gauge parameters from a BQ274XX sensor. Overview ******** diff --git a/samples/sensor/ccs811/README.rst b/samples/sensor/ccs811/README.rst index 38258db5c64afa1..e71da570c09861b 100644 --- a/samples/sensor/ccs811/README.rst +++ b/samples/sensor/ccs811/README.rst @@ -1,7 +1,7 @@ -.. _ccs811: +.. zephyr:code-sample:: ccs811 + :name: CCS811 indoor air quality sensor -CCS811 Indoor Air Quality Sensor -################################ + Get CO2 equivalent and VOC data from a CCS811 sensor. Overview ******** diff --git a/samples/sensor/co2_polling/README.rst b/samples/sensor/co2_polling/README.rst index c0436b363acccaf..c4cc8a47a8f2e4a 100644 --- a/samples/sensor/co2_polling/README.rst +++ b/samples/sensor/co2_polling/README.rst @@ -1,7 +1,7 @@ -.. co2: +.. zephyr:code-sample:: co2 + :name: Generic CO2 polling sample -Generic CO2 polling sample -########################## + Get CO2 data from a sensor using polling. Overview ******** diff --git a/samples/sensor/dht_polling/README.rst b/samples/sensor/dht_polling/README.rst index b985c9e0a082ec1..5fd094c433fc609 100644 --- a/samples/sensor/dht_polling/README.rst +++ b/samples/sensor/dht_polling/README.rst @@ -1,7 +1,7 @@ -.. _dht_polling: +.. zephyr:code-sample:: dht_polling + :name: Generic digital humidity temperature sensor polling -Generic Digital Humidity Temperature sensor polling sample -########################################################## + Get temperature and humidity data from a DHT sensor using polling. Overview ******** diff --git a/samples/sensor/die_temp_polling/README.rst b/samples/sensor/die_temp_polling/README.rst index 96bed6062fa3805..2529835b3e0d521 100644 --- a/samples/sensor/die_temp_polling/README.rst +++ b/samples/sensor/die_temp_polling/README.rst @@ -1,7 +1,7 @@ -.. _die_temp_polling: +.. zephyr:code-sample:: die_temp_polling + :name: CPU die temperature polling -CPU Die Temperature polling -########################### + Get CPU die temperature data from a sensor using polling. Overview ******** diff --git a/samples/sensor/sensor.rst b/samples/sensor/sensor.rst index 567574977dc0b6e..dfc882c2fab10d9 100644 --- a/samples/sensor/sensor.rst +++ b/samples/sensor/sensor.rst @@ -1,10 +1,5 @@ -.. _sensor-samples: +.. zephyr:code-sample-category:: sensors + :name: Sensors + :show-listing: -Sensor Samples -############## - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to use various sensors supported by Zephyr. diff --git a/samples/shields/shields.rst b/samples/shields/shields.rst index 52f436fd93c889a..84960e0158cfcce 100644 --- a/samples/shields/shields.rst +++ b/samples/shields/shields.rst @@ -1,10 +1,5 @@ -.. _shields-samples: +.. zephyr:code-sample-category:: shields + :name: Shields + :show-listing: -Shields Samples -############### - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + Samples that demonstrate the use of shields in Zephyr. diff --git a/samples/subsys/display/display.rst b/samples/subsys/display/display.rst index 955eeaaea5b32f2..fa8143890ed78a5 100644 --- a/samples/subsys/display/display.rst +++ b/samples/subsys/display/display.rst @@ -1,10 +1,13 @@ -.. _display-samples: +.. zephyr:code-sample-category:: display + :name: Display + :show-listing: -Display Samples -############### + These samples demonstrate how to use the display subsystem. .. toctree:: - :maxdepth: 1 + :titlesonly: :glob: + :hidden: + :maxdepth: 1 - **/* + */* \ No newline at end of file diff --git a/samples/subsys/smf/smf.rst b/samples/subsys/smf/smf.rst index bc48258b99f8ff2..772771a6daf1e46 100644 --- a/samples/subsys/smf/smf.rst +++ b/samples/subsys/smf/smf.rst @@ -1,10 +1,5 @@ -.. _smf-samples: +.. zephyr:code-sample-category:: smf + :name: State Machine Framework + :show-listing: -State Machine Framework Samples -############################### - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to use the :ref:`State Machine Framework ` subsystem. diff --git a/samples/subsys/subsys.rst b/samples/subsys/subsys.rst index bf58c7dda63f3d6..4651375ada87283 100644 --- a/samples/subsys/subsys.rst +++ b/samples/subsys/subsys.rst @@ -1,11 +1,5 @@ -.. _subsystem-samples: +.. zephyr:code-sample-category:: subsys + :name: Subsystems + :show-listing: -Various Subsystems Samples -########################## - -.. toctree:: - :titlesonly: - :maxdepth: 2 - :glob: - - */* + These samples demonstrate how to use various subsystems supported by Zephyr. diff --git a/samples/subsys/zbus/zbus.rst b/samples/subsys/zbus/zbus.rst index 052589eed94a991..c45ed3a2e339104 100644 --- a/samples/subsys/zbus/zbus.rst +++ b/samples/subsys/zbus/zbus.rst @@ -1,10 +1,5 @@ -.. _zbus_samples: +.. zephyr:code-sample-category:: zbus + :name: zbus + :show-listing: -zbus Samples -############ - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* + These samples demonstrate how to use the zbus subsystem. diff --git a/samples/tfm_integration/tfm_integration.rst b/samples/tfm_integration/tfm_integration.rst index 02cd3e9785506c9..c778756d3dc59e0 100644 --- a/samples/tfm_integration/tfm_integration.rst +++ b/samples/tfm_integration/tfm_integration.rst @@ -1,13 +1,11 @@ -.. _tfm_integration-samples: - -TF-M Integration Samples -######################## +.. zephyr:code-sample-category:: tfm_integration + :name: TF-M Integration + :show-listing: -.. toctree:: - :maxdepth: 1 - :glob: + These TF-M integration examples can be used with a supported Armv8-M board, and demonstrate how + the TF-M APIs can be used with Zephyr. - */* +.. _tfm_integration-samples: Overview ********