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

[No Merge] Prototype of nextra docs #135

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14,348 changes: 10,404 additions & 3,944 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -14,6 +14,7 @@
"./packages/virtual-keyboard",
"./packages/codemirror",
"./packages/doenetml",
"./packages/docs-nextra",
"./packages/*"
],
"scripts": {
Expand Down
24 changes: 24 additions & 0 deletions packages/docs-nextra/components/counter.tsx
@@ -0,0 +1,24 @@
import React from "react";

import { renderDoenetToContainer } from "@doenet/standalone";

export function MyCounter({children}) {
console.log(children)
return (
<div
ref={(domNode) => {
if (domNode) {
console.log("rendering the doenet");
renderDoenetToContainer(domNode, domNode.textContent || "");
}
}}
>
{`<p>The component</p>
<graph>
<point />
</graph>`}
</div>
);
}

export default MyCounter;
6 changes: 6 additions & 0 deletions packages/docs-nextra/components/dynamic-counter.tsx
@@ -0,0 +1,6 @@
import React from "react";
import dynamic from "next/dynamic";

export const DynamicMyCounter = dynamic(() => import("./counter"), {
ssr: false,
});
10 changes: 10 additions & 0 deletions packages/docs-nextra/next.config.mjs
@@ -0,0 +1,10 @@
import nextraConfig from "nextra";
const withNextra = nextraConfig({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});

export default withNextra();

// If you have other Next.js configurations, you can pass them as the parameter:
// module.exports = withNextra({ /* other next.js config */ })
25 changes: 25 additions & 0 deletions packages/docs-nextra/package.json
@@ -0,0 +1,25 @@
{
"name": "@doenet/docs-nextra",
"type": "module",
"description": "Documentation for DoenetML using Nextra",
"version": "*",
"license": "AGPL-3.0-or-later",
"homepage": "https://github.com/Doenet/DoenetML#readme",
"private": true,
"repository": "github:Doenet/DoenetML",
"files": [
"/dist"
],
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^14.1.4",
"nextra": "^2.13.4",
"nextra-theme-docs": "^2.13.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
21 changes: 21 additions & 0 deletions packages/docs-nextra/pages/index.mdx
@@ -0,0 +1,21 @@
import { DynamicMyCounter } from "../components/dynamic-counter"


# Welcome to Nextra

Hello, world!

<DynamicMyCounter>
{`
<graph>
<point />
</graph>
`}
</DynamicMyCounter>

```html
foo <a href="foo">
```



9 changes: 9 additions & 0 deletions packages/docs-nextra/theme.config.tsx
@@ -0,0 +1,9 @@
import React from "react";

export default {
logo: <span>My Nextra Documentation</span>,
project: {
link: "https://github.com/shuding/nextra",
},
// ... other theme options
};
7 changes: 6 additions & 1 deletion packages/doenetml/src/global-config.ts
@@ -1,7 +1,12 @@
if (typeof window === "undefined") {
// @ts-ignore
globalThis.window = globalThis;
}

export const doenetGlobalConfig = {
doenetWorkerUrl: new URL(
"/doenetml-worker/CoreWorker.js",
window.location.href,
window?.location?.href || "https://doenet.org",
).href,
};
// We want this to be available in the global scope
Expand Down