-
Notifications
You must be signed in to change notification settings - Fork 0
Code block enhancements: filename titles and line highlighting #6
Copy link
Copy link
Open
Labels
contentContent authoring featuresContent authoring featuresenhancementNew feature or requestNew feature or request
Description
Summary
Two related improvements to fenced code blocks that authors commonly expect from modern doc tools:
- Filename/title annotation —
```go title="main.go"renders a filename label above the block - Line highlighting —
```go {3,5-8}highlights specific lines to draw attention
Proposed behaviour
Filename title
```go title="cmd/root.go"
package main
```Renders a label bar above the code block showing the filename.
Line highlighting
```go {2,4-6}
line 1
line 2 ← highlighted
line 3
line 4 ← highlighted
line 5 ← highlighted
line 6 ← highlighted
```Implementation notes
- Both are implemented as a custom goldmark code block renderer (extending the existing Chroma integration in
internal/parser/highlight.go) - Parse extra attributes from the opening fence info string
- Title: inject a
<div class="code-title">before the<pre>block - Line highlighting: wrap highlighted lines in
<span class="highlight-line">, style with CSS - No new dependencies needed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
contentContent authoring featuresContent authoring featuresenhancementNew feature or requestNew feature or request