-
Notifications
You must be signed in to change notification settings - Fork 6.8k
chore(docs): correcting headers and adding header linking #6040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -69,10 +69,25 @@ task('docs', [ | |||
|
|||
/** Generates html files from the markdown overviews and guides. */ | |||
task('markdown-docs', () => { | |||
// Extend the renderer for custom heading anchor rendering | |||
markdown.marked.Renderer.prototype.heading = (text: string, level: number): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs for marked give a different API for customizing a renderer, don't think you're supposed to monkey-patch the renderer prototype:
https://github.com/chjj/marked#overriding-renderer-methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we are using the gulp plugin, I wasn't able to override the renderer like that. In order to do that, I would need to roll our own gulp adapter so we can pass in a custom renderer. Is that something you would like me to look at?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, didn't know the gulp config wasn't a full pass-through
tools/gulp/tasks/docs.ts
Outdated
if(level === 3 || level === 4) { | ||
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-'); | ||
return ` | ||
<h${level} id="${escapedText}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it easier to add the ids during generation than when the html file is loaded on the docs site?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured it would be faster to do it during generation. Happy to change it if you don't fancy this approach.
@jelbourn - please advise on next steps :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -69,10 +69,25 @@ task('docs', [ | |||
|
|||
/** Generates html files from the markdown overviews and guides. */ | |||
task('markdown-docs', () => { | |||
// Extend the renderer for custom heading anchor rendering | |||
markdown.marked.Renderer.prototype.heading = (text: string, level: number): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, didn't know the gulp config wasn't a full pass-through
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR fixes inconsistent headers and adds header linking for the table of contents in the material docs.
This PR is part of angular/material.angular.io#230