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

✨ NEW: Create custom directives #194

Merged
merged 4 commits into from
May 22, 2024
Merged

✨ NEW: Create custom directives #194

merged 4 commits into from
May 22, 2024

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented May 22, 2024

You can use the sd_custom_directives configuration option in your conf.py to add custom directives, with default option values:

sd_custom_directives = {
    "dropdown-syntax": {
        "inherit": "dropdown",
        "argument": "Syntax",
        "options": {
            "color": "primary",
            "icon": "code",
        },
    }
}

The key is the new directive name to add, and the value is a dictionary with the following keys:

  • inherit: The directive to inherit from (e.g. dropdown)
  • argument: The default argument (optional, only for directives that take a single argument)
  • options: A dictionary of default options for the directive (optional)

You can use the `sd_custom_directives` configuration option in your `conf.py` to add custom directives, with default option values:

```python
sd_custom_directives = {
    "dropdown-syntax": {
        "inherit": "dropdown",
        "options": {
            "color": "primary",
            "icon": "code",
        },
    }
}
```

The key is the new directive name to add, and the value is a dictionary with the following keys:

- `inherit`: The directive to inherit from (e.g. `dropdown`)
- `options`: A dictionary of default options for the directive
@codecov-commenter
Copy link

codecov-commenter commented May 22, 2024

Codecov Report

Attention: Patch coverage is 80.83333% with 23 lines in your changes missing coverage. Please review.

Project coverage is 87.66%. Comparing base (af64472) to head (59e581f).
Report is 8 commits behind head on main.

Files Patch % Lines
sphinx_design/shared.py 62.90% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #194      +/-   ##
==========================================
- Coverage   89.18%   87.66%   -1.52%     
==========================================
  Files          11       11              
  Lines         962     1030      +68     
==========================================
+ Hits          858      903      +45     
- Misses        104      127      +23     
Flag Coverage Δ
pytests 87.66% <80.83%> (-1.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chrisjsewell chrisjsewell changed the title ✨ NEW: Custom diretives ✨ NEW: Create custom directives May 22, 2024
@chrisjsewell chrisjsewell merged commit 3374383 into main May 22, 2024
15 checks passed
@chrisjsewell chrisjsewell deleted the custom-directives branch May 22, 2024 15:00
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.

2 participants