facebook / facebook/docusaurus

Support custom heading classes in addition to IDs

Open
#11,628 4 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
TypeScript
Stars
66.2k
Forks
10k
Avg merge
1d 3h
Merged PRs (30d)
52

Description

### Have you read the Contributing Guidelines on issues?

- [x] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Description

In addition to custom heading IDs, also allow setting custom heading classes.

### Has this been requested on Canny?

_No response_

### Motivation

This allows custom styling via CSS or filtering via JS.

### API design

For example, I can imagine a syntax as follows:
```markdown
# Heading {#id .class1 .class2}
```

### Have you tried building it?

This could be implemented in the [heading remark plugin](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-mdx-loader/src/remark/headings/index.ts) where custom IDs are already processed.

### Self-service

- [ ] I'd be willing to contribute this feature to Docusaurus myself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.