mirror of
https://github.com/alecthomas/chroma.git
synced 2025-02-09 13:23:51 +02:00
Add tabindex="0" to default <pre> wrapper
This commit is contained in:
parent
8513d9997e
commit
c8581d47ee
@ -131,7 +131,7 @@ var (
|
||||
}
|
||||
defaultPreWrapper = preWrapper{
|
||||
start: func(code bool, styleAttr string) string {
|
||||
return fmt.Sprintf("<pre%s>", styleAttr)
|
||||
return fmt.Sprintf(`<pre tabindex="0"%s>`, styleAttr)
|
||||
},
|
||||
end: func(code bool) string {
|
||||
return "</pre>"
|
||||
|
@ -202,7 +202,7 @@ func TestWithPreWrapper(t *testing.T) {
|
||||
|
||||
t.Run("Regular", func(t *testing.T) {
|
||||
s := format(New(WithClasses(true)))
|
||||
assert.Equal(t, s, `<pre class="chroma"><span class="nb">echo</span> FOO</pre>`)
|
||||
assert.Equal(t, s, `<pre tabindex="0" class="chroma"><span class="nb">echo</span> FOO</pre>`)
|
||||
})
|
||||
|
||||
t.Run("PreventSurroundingPre", func(t *testing.T) {
|
||||
@ -246,7 +246,7 @@ func TestReconfigureOptions(t *testing.T) {
|
||||
err = f.Format(&buf, styles.Fallback, it)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, `<pre class="chroma"><span class="nb">echo</span> FOO</pre>`, buf.String())
|
||||
assert.Equal(t, `<pre tabindex="0" class="chroma"><span class="nb">echo</span> FOO</pre>`, buf.String())
|
||||
}
|
||||
|
||||
func TestWriteCssWithAllClasses(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user