← GDG /

#270 gdtest_page_tags

#270 gdtest_page_tags OK CONFIG
Page tags with hierarchy, shadow tags, and tag icons
Four user-guide pages tagged with flat, hierarchical, and shadow tags. Tests that tags/index.qmd is generated with all visible tags, that page-tags.js is included for client-side pill rendering, that shadow tags (needs-review, internal) are excluded from the public tag index, and that hierarchical tags like Python/Configuration create nested headings on the tags page. Tag icons are configured for Python, Tutorial, and API.
View Site → Build Log ๐Ÿงช Test Coverage

Build Mode

● Has great-docs.yml

This package ships a pre-supplied config. The great-docs init step is skipped and great-docs build uses the spec-defined configuration directly. Tests specific config options and their rendered output.

Dimensions

T1
T1Page tags with hierarchy + shadowtags

Source Files

๐Ÿ“ gdtest_page_tags/
๐Ÿ“„ __init__.py
"""A test package for the page tags feature."""

__version__ = "0.1.0"
__all__ = ["Widget", "create_widget", "WidgetError"]


class WidgetError(Exception):
    """Raised when a widget operation fails."""


class Widget:
    """
    A configurable widget.

    Parameters
    ----------
    name
        Display name of the widget.
    size
        Size in pixels (default 100).
    """

    def __init__(self, name: str, size: int = 100):
        self.name = name
        self.size = size

    def render(self) -> str:
        """
        Render the widget to HTML.

        Returns
        -------
        str
            An HTML string.
        """
        return f"<widget>{self.name}</widget>"

    def resize(self, new_size: int) -> None:
        """
        Resize the widget.

        Parameters
        ----------
        new_size
            New size in pixels.

        Raises
        ------
        WidgetError
            If new_size is negative.
        """
        if new_size < 0:
            raise WidgetError("Size must be non-negative")
        self.size = new_size


def create_widget(name: str, size: int = 100) -> Widget:
    """
    Factory function for creating widgets.

    Parameters
    ----------
    name
        Display name of the widget.
    size
        Size in pixels (default 100).

    Returns
    -------
    Widget
        A new widget instance.
    """
    return Widget(name, size)
๐Ÿ“ user_guide/
๐Ÿ“„ 01-intro.qmd
---
title: Introduction
tags: [Tutorial, Getting Started]
---

Welcome to the Page Tags Demo user guide!

This guide covers the basics of widget creation.
๐Ÿ“„ 02-configuration.qmd
---
title: Configuration
tags: [Python, Python/Configuration, Tutorial]
---

Learn how to configure widgets for your project.

## Basic Setup

Create a widget with default settings:

```python
from gdtest_page_tags import create_widget

w = create_widget("my-widget")
```
๐Ÿ“„ 03-advanced.qmd
---
title: Advanced Usage
tags: [Python/Advanced, API, needs-review]
---

Advanced patterns for power users.

## Custom Rendering

Override the default render method for custom output.
๐Ÿ“„ 04-errors.qmd
---
title: Error Handling
tags: [Python/Advanced, API, internal]
---

How to handle errors when working with widgets.

## WidgetError

The `WidgetError` exception is raised when an invalid operation
is attempted.
๐Ÿ“„ 05-rendering.qmd
---
title: Rendering Widgets
subtitle: A deep dive into the rendering pipeline
tags: [Python, Tutorial]
---

This page has a subtitle to test tag pill placement.

## The Render Pipeline

Widgets go through a multi-step rendering pipeline before
producing their final HTML output.
๐Ÿ“„ 06-faq.qmd
---
title: Frequently Asked Questions
---

This page has no tags at all.

## Why use widgets?

Widgets provide a reusable, configurable abstraction for
building HTML components.
๐Ÿ“„ 07-tips.qmd
---
title: Tips and Tricks
description: Handy shortcuts and lesser-known features.
tags: [Tutorial]
---

This page uses description (not subtitle) with tags.

## Keyboard Shortcuts

Use Ctrl+W to close the current widget.
๐Ÿ“„ 08-best-practices.qmd
---
title: Best Practices
subtitle: Patterns for production-quality widgets
description: A curated collection of widget best practices.
tags: [Python, Tutorial]
---

This page has both subtitle and description, plus tags.

## Naming Conventions

Use descriptive names for your widgets.
๐Ÿ“„ README.md
# gdtest-page-tags

A test package demonstrating the page tags feature.

## Features

- Tagged user guide pages for discoverability
- Hierarchical tag organization
- Shadow tags for internal use
- Tag icons for visual cues
๐Ÿ“„ great-docs.yml
display_name: Page Tags Demo
tags:
  enabled: true
  index_page: true
  show_on_pages: true
  hierarchical: true
  icons:
    Python: code
    Tutorial: book-open
    API: plug
  shadow:
    - needs-review
    - internal