From 03fd402ea912b474c22938ded0f74c42894391ff Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Fri, 14 Jul 2017 14:22:02 -0400 Subject: [PATCH] docs: make jsdoc generate anchor names so ToC links work (#4471) Also, run some more explicit replacement queries so all ToC links work if they're generated differently from gfm. --- .jsdoc.json | 3 ++- build/fix-api-docs.js | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.jsdoc.json b/.jsdoc.json index e9382d5d8..b9657c03a 100644 --- a/.jsdoc.json +++ b/.jsdoc.json @@ -35,6 +35,7 @@ }, "plugins": ["plugins/markdown"], "markdown": { - "tags": ["example"] + "tags": ["example"], + "idInHeadings": true } } diff --git a/build/fix-api-docs.js b/build/fix-api-docs.js index bf8a37a91..e1915f66e 100644 --- a/build/fix-api-docs.js +++ b/build/fix-api-docs.js @@ -5,7 +5,31 @@ var apiPath = path.join(__dirname, '..', 'docs', 'api'); var replacements = [ {find: /\/docs\/guides\/(.+)\.md/g, replace: 'tutorial-$1.html'}, {find: /tutorial-tech.html/g, replace: 'tutorial-tech_.html'}, - {find: /\/docs\/guides\//g, replace: '#'} + {find: /\/docs\/guides\//g, replace: '#'}, + {find: /(\/g, replace: '$1videojs$2">'}, + {find: /(\/g, replace: '$1dont$2">'}, + {find: /(\/g, replace: '$1nodejs$2">'}, + {find: /(\/g, replace: '$1vttjs$2">'}, + {find: /(\)/g, replace: '$1$2$3'}, + {find: /(\)/g, replace: '$1$2$3'}, + {find: /(\)/g, replace: '$1$2'}, + // replace all children with children-1 + {find: /\

/g, replace: '

'}, + // remove the -1 from the first item + {find: /\

/, replace: '

'}, + {find: '

', replace: '

'}, + {find: '

', replace: '

'}, + {find: '

', replace: '

'}, + {find: '

', + replace: '

'}, + {find: '

', + replace: '

'}, + {find: '

', + replace: '

'}, + {find: '

', replace: '

'}, + {find: '

', replace: '

'} ];