-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: basic symbols missing from examples #1
- Loading branch information
Showing
3 changed files
with
43 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2024 Tiny Tapeout LTD | ||
// Author: Uri Shaked | ||
|
||
/** Convert a GitHub URL to a raw.githubusercontent.com URL */ | ||
export function githubURLToRaw(path: string) { | ||
const parsedURL = new URL(path); | ||
if (parsedURL.hostname !== 'github.com') { | ||
return path; | ||
} | ||
|
||
parsedURL.hostname = 'raw.githubusercontent.com'; | ||
const pathParts = parsedURL.pathname.substring(1).split('/'); | ||
if (pathParts[2] === 'blob') { | ||
pathParts.splice(2, 1); | ||
parsedURL.pathname = pathParts.join('/'); | ||
} | ||
return parsedURL.toString(); | ||
} |