Pygments' inline line number spans (<span class="lineno">) are not stripped during code extraction, so line numbers appear concatenated with code content.
Example
https://nn.labml.ai/graphs/gat/index.html
<div class="highlight"><pre><span class="lineno">28</span><span></span><span class="kn">import</span> <span class="nn">torch</span>
<span class="lineno">29</span><span class="kn">from</span> <span class="nn">torch</span> <span class="kn">import</span> <span class="n">nn</span></pre></div>
Expected:
```
import torch
from torch import nn
```
Actual:
```
28
import torch
29
from torch import nn
```
Root cause
extractStructuredText in elements/code.ts skips several line number formats (span.lnt for Chroma, .react-syntax-highlighter-line-number, .rouge-gutter) but not Pygments' span.lineno.
Fix direction
Add a skip for span.lineno, same pattern as the existing span.lnt skip:
if (element.matches('span.lineno')) {
return '';
}
Pygments' inline line number spans (
<span class="lineno">) are not stripped during code extraction, so line numbers appear concatenated with code content.Example
https://nn.labml.ai/graphs/gat/index.html
Expected:
Actual:
Root cause
extractStructuredTextinelements/code.tsskips several line number formats (span.lntfor Chroma,.react-syntax-highlighter-line-number,.rouge-gutter) but not Pygments'span.lineno.Fix direction
Add a skip for
span.lineno, same pattern as the existingspan.lntskip: