@@ -11,7 +11,6 @@ complete control over formatting and syntax highlighting */
11
11
const fs = require ( 'fs' ) ;
12
12
const path = require ( 'path' ) ;
13
13
const url = require ( 'url' ) ;
14
- const util = require ( 'util' ) ;
15
14
16
15
const hljs = require ( 'highlight.js' ) ;
17
16
const cheerio = require ( 'cheerio' ) ;
@@ -196,7 +195,6 @@ let indents = [0];
196
195
// process the markdown
197
196
for ( let l in lines ) {
198
197
let line = lines [ l ] ;
199
- let linkTarget ;
200
198
201
199
if ( line . startsWith ( '## Table of Contents' ) ) inTOC = true ;
202
200
if ( line . startsWith ( '<!-- /TOC' ) ) inTOC = false ;
@@ -238,20 +236,9 @@ for (let l in lines) {
238
236
newIndent ++ ;
239
237
}
240
238
241
- if ( line . indexOf ( '<a name=' ) >= 0 ) {
242
- let comp = line . split ( '</a>' ) ;
243
- let title = comp [ 1 ] ;
244
- if ( inDefs ) title = '<dfn>' + title + '</dfn>' ;
245
- let link = comp [ 0 ] . split ( '<a ' ) [ 1 ] . replace ( 'name=' , 'id=' ) ;
246
- const anchor = link . split ( "'" ) . join ( '"' ) . split ( '"' ) [ 1 ] ;
247
- line = '#' . repeat ( newIndent ) + ' <span>' + title + '</span>' ;
248
- linkTarget = '<a id="' + anchor + '"></a>' ;
249
- }
250
- else {
251
- let title = line . split ( '# ' ) [ 1 ] ;
252
- if ( inDefs ) title = '<dfn>' + title + '</dfn>' ;
253
- line = ( '#' . repeat ( newIndent ) + ' ' + title ) ;
254
- }
239
+ let title = line . split ( '# ' ) [ 1 ] ;
240
+ if ( inDefs ) title = '<dfn>' + title + '</dfn>' ;
241
+ line = ( '#' . repeat ( newIndent ) + ' ' + title ) ;
255
242
256
243
if ( delta > 0 ) indents . push ( originalIndent ) ;
257
244
if ( delta < 0 ) {
@@ -267,10 +254,11 @@ for (let l in lines) {
267
254
if ( line . indexOf ( '<a name="' ) >= 0 ) {
268
255
if ( line . indexOf ( '<a name="parameterAllowEmptyValue"/>' ) >= 0 )
269
256
// fix syntax error in 2.0.md
270
- line = line . replace ( '<a name="parameterAllowEmptyValue"/>' , '<a id="parameterAllowEmptyValue"></a>' ) ;
271
- else
272
- line = line . replace ( '<a name=' , '<a id=' ) ;
273
- line = line . replace ( '"></a>' , '" class="logo"></a>' ) ;
257
+ line = line . replace ( '<a name="parameterAllowEmptyValue"/>' , '<span id="parameterAllowEmptyValue"></span>' ) ;
258
+ else {
259
+ line = line . replace ( '<a name=' , '<span id=' ) ;
260
+ line = line . replace ( '</a>' , '</span>' ) ;
261
+ }
274
262
}
275
263
276
264
line = line . split ( '\\|' ) . join ( '|' ) ; // was ¦
@@ -347,7 +335,7 @@ for (let l in lines) {
347
335
line = prefix + md . render ( line ) ;
348
336
}
349
337
350
- lines [ l ] = ( linkTarget ? linkTarget : '' ) + line ;
338
+ lines [ l ] = line ;
351
339
}
352
340
353
341
s = preface ( `OpenAPI Specification v${ argv . subtitle } | Introduction, Definitions, & More` , argv ) + '\n\n' + lines . join ( '\n' ) ;
0 commit comments