1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-17 20:58:08 +02:00

Removes 'tabindex="0"' from `<pre>' elements

This commit is contained in:
Itamar Haber 2023-01-19 16:59:46 +02:00 committed by Alec Thomas
parent 3d1bc51fa8
commit 633f8e0f55
2 changed files with 4 additions and 4 deletions

View File

@ -171,10 +171,10 @@ var (
defaultPreWrapper = preWrapper{
start: func(code bool, styleAttr string) string {
if code {
return fmt.Sprintf(`<pre tabindex="0"%s><code>`, styleAttr)
return fmt.Sprintf(`<pre%s><code>`, styleAttr)
}
return fmt.Sprintf(`<pre tabindex="0"%s>`, styleAttr)
return fmt.Sprintf(`<pre%s>`, styleAttr)
},
end: func(code bool) string {
if code {

View File

@ -293,7 +293,7 @@ func TestWithPreWrapper(t *testing.T) {
t.Run("Regular", func(t *testing.T) {
s := format(New(WithClasses(true)))
assert.Equal(t, s, `<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`)
assert.Equal(t, s, `<pre class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`)
})
t.Run("PreventSurroundingPre", func(t *testing.T) {
@ -347,7 +347,7 @@ func TestReconfigureOptions(t *testing.T) {
err = f.Format(&buf, styles.Fallback, it)
assert.NoError(t, err)
assert.Equal(t, `<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`, buf.String())
assert.Equal(t, `<pre class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`, buf.String())
}
func TestWriteCssWithAllClasses(t *testing.T) {