Skip to content
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: add comments to docs #2358

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/client/commentTest.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sidebar_label: Comment Test
title: Comment Test
---

import GiscusComments from "@site/src/components/GiscusComments";


Rust stands out among programming languages for its unique combination of performance and safety. Unlike languages such as C++ that prioritize performance at the cost of memory safety, Rust delivers this without compromise.

Key advantages of Rust include:
- Zero-cost abstractions that provide high-level programming constructs without runtime overhead
- Memory safety guaranteed at compile time through its ownership system
- Thread safety enforced by the compiler, eliminating data races

These features make Rust an excellent choice for systems programming, embedded systems, WebAssembly development, and any performance-critical applications where reliability is crucial.



```rust
fn main() {
println!("Hello, world!");
}
```
<GiscusComments />
4 changes: 3 additions & 1 deletion docs/client/javascript-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "../sdks/_SDKDocsBuilder.mdx";

import { FeaturePillList } from '@site/src/components/FeaturePillList';

import GiscusComments from "@site/src/components/GiscusComments";
import {
Repository,
FAQ,
Expand Down Expand Up @@ -136,3 +136,5 @@ export const toc = Builder.toc;
}
/>
<>{Builder.result}</>

<GiscusComments />
74 changes: 74 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@easyops-cn/docusaurus-search-local": "^0.44.5",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@giscus/react": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@mui/material": "^5.16.7",
"@radix-ui/react-slot": "^1.1.0",
Expand Down
45 changes: 45 additions & 0 deletions src/components/GiscusComments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
/* <script src="https://giscus.app/client.js"
data-repo="statsig-io/docs"
data-repo-id="MDEwOlJlcG9zaXRvcnkzNTQxNDU1NzA="
data-category="Announcements"
data-category-id="DIC_kwDOFRvVIs4CkZAC"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
crossorigin="anonymous"
async>
</script> */
}

import React from "react";
import Giscus from "@giscus/react";
import { useColorMode } from "@docusaurus/theme-common";

export default function GiscusComments() {
const { colorMode } = useColorMode();

return (
<Giscus
repo="statsig-io/docs"
repoId="MDEwOlJlcG9zaXRvcnkzNTQxNDU1NzA="
category="Announcements"
categoryId="DIC_kwDOFRvVIs4CkZAC"
mapping="pathname"
// term="specific-term" //If you didn't select "Discussion title contains a specific term", omit.
strict="0"
reactionsEnabled="1"
emitMetadata="1"
inputPosition="bottom"
theme={colorMode}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The theme prop expects specific values from Giscus, and colorMode won't work here. Using theme="preferred_color_scheme" will allow Giscus to properly handle light/dark mode switching based on the user's system preferences.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

lang="en"
loading="lazy"
crossorigin="anonymous"
async
/>
);
}
Loading