-
Notifications
You must be signed in to change notification settings - Fork 26
Add links to source code from analytics events documentation #337
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ interface HeadingProps { | |||||||||
| level: HeadingLevel; | ||||||||||
|
|
||||||||||
| id?: string; | ||||||||||
| className?: string; | ||||||||||
|
|
||||||||||
| children: string; | ||||||||||
| } | ||||||||||
|
|
@@ -15,11 +16,12 @@ export function Heading({ | |||||||||
| level, | ||||||||||
| children, | ||||||||||
| id = urlify(children), | ||||||||||
| className, | ||||||||||
| }: HeadingProps) { | ||||||||||
|
Comment on lines
+19
to
20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could also consider forwarding along any valid HTML props.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok! And we'd want to remove those from the definition of HeadingProps then, right?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah there's a few more revisions that would need to be done in addition to that suggestion (also importing the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. y'know, in retrospect, I think this is fine as-is, if you want to just leave it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOL ok will leave it |
||||||||||
| const TagName = level; | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <TagName id={id}> | ||||||||||
| <TagName id={id} className={className}> | ||||||||||
| {children} | ||||||||||
| <AnchorLink slug={id} /> | ||||||||||
| </TagName> | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| export function permalink({ | ||
| repo, | ||
| ref = "main", | ||
| file, | ||
| line, | ||
| }: { | ||
| repo: string; | ||
| file: string; | ||
| ref?: string; | ||
| line?: number | string; | ||
| }) { | ||
| return `https://github.com/${repo}/blob/${ref}/${file}${ | ||
| line ? `#L${line}` : "" | ||
| }`; | ||
| } | ||
|
|
||
| export function searchURL({ | ||
| needle, | ||
| repo, | ||
| extension, | ||
| path, | ||
|
zachmargolis marked this conversation as resolved.
|
||
| type, | ||
| }: { | ||
| needle?: string; | ||
| path?: string; | ||
| repo?: string; | ||
| /** | ||
| * @example "rb" | ||
| */ | ||
| extension?: string; | ||
| type?: | ||
| | "repositories" | ||
| | "code" | ||
| | "commits" | ||
| | "issues" | ||
| | "discussions" | ||
| | "registrypackages" | ||
| | "wikis" | ||
| | "users"; | ||
| }) { | ||
| const url = new URL("https://github.com/search"); | ||
|
|
||
| const q = [ | ||
| needle, | ||
| repo && `repo:${repo}`, | ||
| extension && `extension:${extension}`, | ||
| path && `path:${path}`, | ||
| ] | ||
| .filter(Boolean) | ||
| .join(" "); | ||
|
|
||
| if (q) { | ||
| url.searchParams.set("q", q); | ||
| } | ||
|
|
||
| if (type) { | ||
| url.searchParams.set("type", type); | ||
| } | ||
|
|
||
| return url.toString(); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.