release-notes-05
Meng Zhang 2023-11-03 13:51:36 -07:00
parent 4dfc189271
commit fb222e5d66
4 changed files with 80 additions and 64 deletions

View File

@ -1,12 +1,12 @@
import { GitHubReadme } from "react-github-readme-md";
---
sidebar_position: 4
---
# 🧑‍🔬 Models Directory
import GitHubReadme from "./readme";
<GithubReadme username="TabbyML" repo="registry-tabby" />
# 🧑‍🔬 Models Registry
<GitHubReadme src="https://raw.githubusercontent.com/TabbyML/registry-tabby/main/README.md" />
## Alternative Registry

74
website/docs/models/readme.tsx vendored Normal file
View File

@ -0,0 +1,74 @@
import React, { useState, useEffect } from "react";
import { marked } from "marked";
const GitHubReadme: React.FC<{
src?: string;
}> = ({
src,
}) => {
if (!src) {
console.error(
"react-github-readme-md: You must provide either a src or username and repo"
);
return null;
}
const [readmeContent, setReadmeContent] = useState<string>("");
useEffect(() => {
// Function to fetch the README content from GitHub
const fetchReadme = async () => {
try {
let readmeUrl = "";
if (src) {
// Allow passing a URL directly as a prop
readmeUrl = src;
}
if (!readmeUrl) {
throw new Error("Failed to fetch README path");
}
const response = await fetch(readmeUrl);
if (!response.ok) {
throw new Error("Failed to fetch README");
}
const data = await response.text();
if (data) {
setReadmeContent(data.split("\n").splice(1).join("\n"));
}
} catch (error) {
console.error("react-github-readme-md: ", error);
}
};
fetchReadme();
}, []);
if (!readmeContent) {
return null;
}
// Parse the markdown content into HTML
try {
const ghContent = marked.parse(readmeContent);
return (
<div>
<div
dangerouslySetInnerHTML={{
__html: ghContent,
}}
/>
</div>
);
} catch (error) {
console.error("react-github-readme-md: ", error);
return null;
}
};
export default GitHubReadme;

View File

@ -22,13 +22,13 @@
"axios": "^1.4.0",
"clsx": "^1.2.1",
"docusaurus-preset-openapi": "^0.6.4",
"marked": "^9.1.5",
"postcss": "^8.4.24",
"posthog-docusaurus": "^2.0.0",
"prism-react-renderer": "^1.3.5",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-github-readme-md": "^1.2.0",
"tailwindcss": "^3.3.2",
"url": "^0.11.0"
},

60
website/yarn.lock vendored
View File

@ -2128,11 +2128,6 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb"
integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==
"@types/linkify-it@^3.0.3":
version "3.0.4"
resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.4.tgz#def6a9bb0ce78140860602f16ace37a9997f086a"
integrity sha512-hPpIeeHb/2UuCw06kSNAOVWgehBLXEo0/fUs0mw3W2qhqX89PI2yvok83MnuctYGCPrabGIoi0fFso4DQ+sNUQ==
"@types/mdast@^3.0.0":
version "3.0.11"
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.11.tgz#dc130f7e7d9306124286f6d6cee40cf4d14a3dc0"
@ -4422,11 +4417,6 @@ github-slugger@^1.4.0:
resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.5.0.tgz#17891bbc73232051474d68bd867a34625c955f7d"
integrity sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==
github-slugger@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-2.0.0.tgz#52cf2f9279a21eb6c59dd385b410f0c0adda8f1a"
integrity sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==
glob-parent@^5.1.2, glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
@ -5403,13 +5393,6 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
linkify-it@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-4.0.1.tgz#01f1d5e508190d06669982ba31a7d9f56a5751ec"
integrity sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==
dependencies:
uc.micro "^1.0.1"
liquid-json@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/liquid-json/-/liquid-json-0.3.1.tgz#9155a18136d8a6b2615e5f16f9a2448ab6b50eea"
@ -5566,26 +5549,6 @@ markdown-escapes@^1.0.0:
resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535"
integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==
marked-alert@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/marked-alert/-/marked-alert-1.1.2.tgz#fdddc3e3765c349fc7af80357d7230adeae72055"
integrity sha512-hrj2mJyiMqWvdAryc0spOCcKSy72vm8hqKf22tBvXxSub0YbdnSydoT+E2/GFCZXR2rpQ8PjvkSmzkqr2cQEgw==
marked-gfm-heading-id@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/marked-gfm-heading-id/-/marked-gfm-heading-id-3.1.0.tgz#f414c987a6d1cac4078829089a8cb01e9a07c005"
integrity sha512-PYgLXDbL64Ga6kCpvVuKVoIVsV6MKUtkOXnR8mIqyjiycAeKNhQxcGpO0mHEogOTzyY8A8TcK49k5VwYMUCCbg==
dependencies:
github-slugger "^2.0.0"
marked-linkify-it@^3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/marked-linkify-it/-/marked-linkify-it-3.1.4.tgz#6bf413bb0d49f38b21254539839fcdfae92b31d9"
integrity sha512-jKssH4Xt82ZriU1esB6aeNmIsFmTnYBiiveXvE+7XNRq4+euiE/zgW/hn+6Y5KhbtBGTMhaFcyibsSF8FYLHIg==
dependencies:
"@types/linkify-it" "^3.0.3"
linkify-it "^4.0.1"
marked@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/marked/-/marked-1.1.1.tgz#e5d61b69842210d5df57b05856e0c91572703e6a"
@ -5596,7 +5559,7 @@ marked@2.0.1:
resolved "https://registry.yarnpkg.com/marked/-/marked-2.0.1.tgz#5e7ed7009bfa5c95182e4eb696f85e948cefcee3"
integrity sha512-5+/fKgMv2hARmMW7DOpykr2iLhl0NgjyELk5yn92iE7z8Se1IS9n3UsFm86hFXIkvMBmVxki8+ckcpjBeyo/hw==
marked@9:
marked@^9.1.5:
version "9.1.5"
resolved "https://registry.yarnpkg.com/marked/-/marked-9.1.5.tgz#fcada4702ea64a5c05a4ff0e0639628aac8a1e5f"
integrity sha512-14QG3shv8Kg/xc0Yh6TNkMj90wXH9mmldi5941I2OevfJ/FQAFLEwtwU2/FfgSAOMlWHrEukWSGQf8MiVYNG2A==
@ -7012,17 +6975,6 @@ react-fast-compare@^3.2.0:
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49"
integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==
react-github-readme-md@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/react-github-readme-md/-/react-github-readme-md-1.2.0.tgz#955a57d28baf2b1369586412066d08bfe44d3e5b"
integrity sha512-vGanU1J8sG4mD8DKtgz3QJ6cRCOdzKYCdgCloMRS/tAdZuPPRQU/zNfDgS+wg4YfWnQdIknrPHA2Rqm1APoEKg==
dependencies:
marked "9"
marked-alert "^1.1.1"
marked-gfm-heading-id "^3.1.0"
marked-linkify-it "^3.1.4"
whatwg-fetch "^3.6.19"
react-helmet-async@*, react-helmet-async@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.3.0.tgz#7bd5bf8c5c69ea9f02f6083f14ce33ef545c222e"
@ -8233,11 +8185,6 @@ ua-parser-js@^1.0.35:
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.35.tgz#c4ef44343bc3db0a3cbefdf21822f1b1fc1ab011"
integrity sha512-fKnGuqmTBnIE+/KXSzCn4db8RTigUzw1AN0DmdU6hJovUTbYJKyqj+8Mt1c4VfRDnOVJnENmfYkIPZ946UrSAA==
uc.micro@^1.0.1:
version "1.0.6"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
unherit@^1.0.4:
version "1.1.3"
resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.3.tgz#6c9b503f2b41b262330c80e91c8614abdaa69c22"
@ -8696,11 +8643,6 @@ websocket-extensions@>=0.1.1:
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==
whatwg-fetch@^3.6.19:
version "3.6.19"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.19.tgz#caefd92ae630b91c07345537e67f8354db470973"
integrity sha512-d67JP4dHSbm2TrpFj8AbO8DnL1JXL5J9u0Kq2xW6d0TFDbCA3Muhdt8orXC22utleTVj7Prqt82baN6RBvnEgw==
whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"