docgen: use github-slugger to generate better slugs
This commit is contained in:
@@ -29,11 +29,13 @@
|
||||
"chalk": "^4.0.0",
|
||||
"commander": "^4.1.1",
|
||||
"fs-extra": "^9.0.0",
|
||||
"typescript": "^3.9.3",
|
||||
"ts-node": "^8.6.2"
|
||||
"github-slugger": "^1.3.0",
|
||||
"ts-node": "^8.6.2",
|
||||
"typescript": "^3.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/github-slugger": "^1.3.0",
|
||||
"@types/node": "^13.7.2",
|
||||
"nodemon": "^2.0.2"
|
||||
},
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import GithubSlugger from 'github-slugger';
|
||||
import sortSelector from './sortSelector';
|
||||
import { MarkdownPrinter, TypeLink } from './types';
|
||||
import { execSync } from 'child_process';
|
||||
@@ -46,7 +47,7 @@ export default class GithubMarkdownPrinter implements MarkdownPrinter {
|
||||
}
|
||||
|
||||
headerLink(heading: string): string {
|
||||
const slug = heading.replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
||||
const slug = GithubSlugger.slug(heading);
|
||||
return `#${slug}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user