mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-21 21:17:50 +02:00
Removes 'tabindex="0"' from `<pre>' elements
This commit is contained in:
parent
3d1bc51fa8
commit
633f8e0f55
@ -171,10 +171,10 @@ var (
|
|||||||
defaultPreWrapper = preWrapper{
|
defaultPreWrapper = preWrapper{
|
||||||
start: func(code bool, styleAttr string) string {
|
start: func(code bool, styleAttr string) string {
|
||||||
if code {
|
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 {
|
end: func(code bool) string {
|
||||||
if code {
|
if code {
|
||||||
|
@ -293,7 +293,7 @@ func TestWithPreWrapper(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("Regular", func(t *testing.T) {
|
t.Run("Regular", func(t *testing.T) {
|
||||||
s := format(New(WithClasses(true)))
|
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) {
|
t.Run("PreventSurroundingPre", func(t *testing.T) {
|
||||||
@ -347,7 +347,7 @@ func TestReconfigureOptions(t *testing.T) {
|
|||||||
err = f.Format(&buf, styles.Fallback, it)
|
err = f.Format(&buf, styles.Fallback, it)
|
||||||
|
|
||||||
assert.NoError(t, err)
|
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) {
|
func TestWriteCssWithAllClasses(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user