1919
2020 < link rel ="stylesheet " href ="./style.css ">
2121 < link rel ="stylesheet " href ="https://unpkg.com/syntax-highlight-element@next/dist/themes/prettylights.css " data-she-theme >
22-
2322 < script >
2423 // Ensure the event listener is setup before the initial `color-scheme-switch` event gets fired.
2524 document . addEventListener ( 'color-scheme-switch' , event => {
6059 < h1 class ="tagline "> A custom element that uses the CSS Custom Highlight API for syntax highlighting</ h1 >
6160 < p class ="badges ">
6261 < a href ="https://www.npmjs.com/package/syntax-highlight-element ">
63- < img src ="https://img.shields.io/npm/v/syntax-highlight-element?color=32A9C3&labelColor=1B3C4A " alt ="npm version " />
62+ < img src ="https://img.shields.io/npm/v/syntax-highlight-element?color=32A9C3&labelColor=1B3C4A " height =" 20 " alt ="npm version " />
6463 </ a >
65- < a href ="https://www.npmjs.com/package/syntax-highlight-element "> < img src ="https://img.shields.io/npm/dm/syntax-highlight-element?color=32A9C3&labelColor=1B3C4A " alt ="npm downloads "> </ a >
66- < a href ="https://github.com/andreruffert/syntax-highlight-element "> < img src ="https://img.shields.io/badge/source-a?logo=github&color=1B3C4A " alt ="GitHub "> </ a >
64+ < a href ="https://www.npmjs.com/package/syntax-highlight-element "> < img src ="https://img.shields.io/npm/dm/syntax-highlight-element?color=32A9C3&labelColor=1B3C4A " height =" 20 " alt ="npm downloads "> </ a >
65+ < a href ="https://github.com/andreruffert/syntax-highlight-element "> < img src ="https://img.shields.io/badge/source-a?logo=github&color=1B3C4A " height =" 20 " alt ="Source on GitHub "> </ a >
6766 </ p >
6867 < div class ="copy-code-container ">
6968 < div class ="copy-code ">
7069 < syntax-highlight id ="copy-npm-install "> npm install syntax-highlight-element</ syntax-highlight >
71- < clipboard-copy for ="copy-npm-install " class ="button ">
72- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
70+ < clipboard-copy for ="copy-npm-install " class ="button " aria-label =" Copy content " >
71+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
7372 </ clipboard-copy >
7473 </ div >
7574 </ div >
@@ -99,8 +98,8 @@ <h2>Install</h2>
9998 < p > Install via npm</ p >
10099 < div class ="copy-code ">
101100 < syntax-highlight id ="copy-install-npm "> npm install syntax-highlight-element</ syntax-highlight >
102- < clipboard-copy for ="copy-install-npm " class ="button ">
103- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
101+ < clipboard-copy for ="copy-install-npm " class ="button " aria-label =" Copy content " >
102+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
104103 </ clipboard-copy >
105104 </ div >
106105 </ article >
@@ -110,33 +109,33 @@ <h3>JavaScript</h3>
110109 < p > Import as ES module</ p >
111110 < div class ="copy-code ">
112111 < syntax-highlight language ="js " id ="copy-usage-import-js "> import 'syntax-highlight-element';</ syntax-highlight >
113- < clipboard-copy for ="copy-usage-import-js " class ="button ">
114- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
112+ < clipboard-copy for ="copy-usage-import-js " class ="button " aria-label =" Copy content " >
113+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
115114 </ clipboard-copy >
116115 </ div >
117116 < p > Or via CDN</ p >
118117 < div class ="copy-code ">
119118 < syntax-highlight language ="html " id ="copy-usage-cdn-js "> <script type="module" src="https://unpkg.com/syntax-highlight-element@latest/dist/syntax-highlight-element.js"></script></ syntax-highlight >
120- < clipboard-copy for ="copy-usage-cdn-js " class ="button ">
121- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
119+ < clipboard-copy for ="copy-usage-cdn-js " class ="button " aria-label =" Copy content " >
120+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
122121 </ clipboard-copy >
123122 </ div >
124123 < h3 > HTML</ h3 >
125124 < div class ="copy-code ">
126125 < syntax-highlight language ="html " id ="copy-usage-html "> <syntax-highlight language="js">
127126 // ...
128127</syntax-highlight></ syntax-highlight >
129- < clipboard-copy for ="copy-usage-html " class ="button ">
130- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
128+ < clipboard-copy for ="copy-usage-html " class ="button " aria-label =" Copy content " >
129+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
131130 </ clipboard-copy >
132131 </ div >
133132 < h3 > CSS</ h3 >
134133 < p > Make sure to load a theme e.g. < code > syntax-highlight-element/themes/prettylights.css</ code > .</ p >
135134 < p > Or via CDN</ p >
136135 < div class ="copy-code ">
137136 < syntax-highlight language ="html " id ="copy-usage-cdn-css "> <link rel="stylesheet" href="https://unpkg.com/syntax-highlight-element@latest/dist/themes/prettylights.css"></ syntax-highlight >
138- < clipboard-copy for ="copy-usage-cdn-css " class ="button ">
139- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
137+ < clipboard-copy for ="copy-usage-cdn-css " class ="button " aria-label =" Copy content " >
138+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
140139 </ clipboard-copy >
141140 </ div >
142141 </ article >
@@ -163,7 +162,7 @@ <h1>Configuration</h1>
163162/** @type {Config} */
164163window.she.config = {};</ syntax-highlight >
165164 < clipboard-copy for ="copy-config " class ="button " aria-label ="Copy content ">
166- < svg class ="icon " width ="1em " height ="1em "> < use xlink:href ="#copy "> </ use > </ svg >
165+ < svg class ="icon " width ="1em " height ="1em " aria-hidden =" true " > < use xlink:href ="#copy "> </ use > </ svg >
167166 </ clipboard-copy >
168167 </ div >
169168 </ section >
@@ -218,8 +217,8 @@ <h1>Credits</h1>
218217 }
219218
220219 /**
221- * Language example switcher
222- */
220+ * Language example switcher
221+ */
223222 const playgroundCode = document . querySelector ( '[data-section="playground"] syntax-highlight' ) ;
224223 const languageSelector = document . querySelector ( '#example-language-select' ) ;
225224 const languageOptions = Object . keys ( languageExamples ) . map ( ( name , index ) => {
@@ -245,8 +244,8 @@ <h1>Credits</h1>
245244 playgroundCode . setAttribute ( 'language' , languageExamples [ DEFAULT_LANGUAGE_EXAMPLE ] . language ) ;
246245
247246 /**
248- * Theme preset switcher
249- */
247+ * Theme preset switcher
248+ */
250249 const themeStyles = document . querySelector ( '[data-she-theme]' ) ;
251250 const themeSelector = document . querySelector ( '#theme-preset-select' ) ;
252251 const themeOptions = Object . keys ( themePresets ) . map ( ( name , index ) => {
@@ -269,10 +268,8 @@ <h1>Credits</h1>
269268 const button = event . target ;
270269 const icon = button . querySelector ( '.icon use' ) ;
271270 const defaultAriaLabel = button . getAttribute ( 'aria-label' ) ;
272-
273271 button . setAttribute ( 'aria-label' , 'Copied!' ) ;
274272 icon . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , '#check' ) ;
275-
276273 setTimeout ( ( ) => {
277274 button . setAttribute ( 'aria-label' , defaultAriaLabel ) ;
278275 icon . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , '#copy' ) ;
0 commit comments