File tree Expand file tree Collapse file tree 3 files changed +28
-12
lines changed
Expand file tree Collapse file tree 3 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ describe('End to End tests', () => {
7272 ) ;
7373 } ) ;
7474 } ) ;
75+
76+ it ( 'links commentbox' , async ( ) => {
77+ await executeTest (
78+ 'https://github.com/OctoLinker/OctoLinker/pull/451/files' ,
79+ 'https://nodejs.org/api/path.html' ,
80+ '.highlight-source-js .octolinker-link' ,
81+ ) ;
82+ } ) ;
7583 } ) ;
7684
7785 describe . skip ( 'expanded blob' , ( ) => {
Original file line number Diff line number Diff line change 1414 {
1515 "url" : " https://github.com/OctoLinker/OctoLinker/pull/451/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R42" ,
1616 "targetUrl" : " https://github.com/eslint/eslint"
17+ },
18+ {
19+ "url" : " https://github.com/OctoLinker/OctoLinker/pull/451/files#diff-11e9f7f953edc64ba14b0cc350ae7b9dL2" ,
20+ "targetUrl" : " https://github.com/webpack-contrib/copy-webpack-plugin"
21+ },
22+ {
23+ "url" : " https://github.com/OctoLinker/OctoLinker/pull/451/files#diff-11e9f7f953edc64ba14b0cc350ae7b9dR2" ,
24+ "targetUrl" : " https://github.com/webpack-contrib/copy-webpack-plugin"
1725 }
1826]
Original file line number Diff line number Diff line change @@ -5,17 +5,13 @@ function getBlobCodeInner(el) {
55}
66
77function getBlobWrapper ( rootElement = document ) {
8- let ret = [ ] . slice . call (
9- rootElement . getElementsByClassName ( 'js-blob-wrapper' ) ,
10- ) ;
11-
12- if ( ! ret . length ) {
13- ret = [ ] . slice . call ( rootElement . getElementsByClassName ( 'blob-wrapper' ) ) ;
14- }
15-
16- if ( ! ret . length ) {
17- ret = [ ] . slice . call ( rootElement . getElementsByClassName ( 'highlight' ) ) ;
18- }
8+ const ret = [
9+ ...[ ] . slice . call ( rootElement . getElementsByClassName ( 'blob-wrapper' ) ) ,
10+ ...[ ] . slice . call ( rootElement . getElementsByClassName ( 'js-blob-wrapper' ) ) ,
11+ ...[ ] . slice . call (
12+ rootElement . querySelectorAll ( '[class*="highlight-source-"]' ) ,
13+ ) ,
14+ ] ;
1915
2016 return ret ;
2117}
@@ -204,7 +200,11 @@ function readLine(el) {
204200}
205201
206202function readLines ( el ) {
207- if ( el . classList . contains ( 'highlight' ) ) {
203+ if (
204+ el . classList . contains ( 'highlight' ) &&
205+ el . firstElementChild &&
206+ el . firstElementChild . nodeName === 'PRE'
207+ ) {
208208 const issueCode = el . getElementsByTagName ( 'pre' ) ;
209209 if ( issueCode . length ) {
210210 return issueCode [ 0 ] . textContent . split ( / \n / ) . map ( ( line , index ) => ( {
You can’t perform that action at this time.
0 commit comments