-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: render heading support restricted level #28
base: main
Are you sure you want to change the base?
feat: render heading support restricted level #28
Conversation
src/render.ts
Outdated
@@ -14,6 +14,7 @@ | |||
* @group render_utils | |||
*/ | |||
export function 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.
Maybe we should restrict the type for level as well?
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.
Yes, it's done.
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 mean
export function heading(text: string, level: number): string { | |
export function heading(text: string, level: 1|2|3|4|5|6): 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.
I won't pin all my hopes on typescript, I will if you want.
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.
we can also use |(number & {})
to make your life better? :p
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 still want to use the number
type and handle the level
inside the function, So that it can be called recursively without error.
No description provided.