mui / mui/material-ui

[docs-infra] Add line and word highlighting on code blocks

Open
#41,509 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

design scope: docs-infra type: new feature
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Summary

Sometimes, we may want to draw attention to a specific part of a code snippet. That can be either a small function, a variable, or an entire line. We currently lack a way of doing this "natively" within our docs-infra experience. Here's just a quick preview of what this could look like:

Screenshot 2024-03-15 at 19 28 49

Benchmark

  • @atomiks shared his rehype-pretty-code library that we could potentially use! In terms of DX, I don't think we should deviate too much from how it is done in it.
  • Docusaurus also has its own way of adding this feature that we can be inspired by too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Start by reviewing the rehype-pretty-code and Docusaurus references to understand their highlighting syntax and behavior, then determine the supported line and word-highlighting scope for docs-infra. Done means code blocks can visibly highlight the requested parts through the agreed documentation syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.