-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nextra codeblocks for displaying doenet code and rendered results (#228)
* Create nextra codeblocks for doenet-example, doenet-viewer, doenet-editor, and doenet-editor-horiz. * Update documentation to use new nextra codeblocks --------- Co-authored-by: Jason Siefken <[email protected]>
- Loading branch information
Showing
46 changed files
with
530 additions
and
459 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react"; | ||
import { DoenetViewer } from "./doenet"; | ||
import { Tabs } from "nextra/components"; | ||
|
||
/** | ||
* Render DoenetML as an example in documentation. | ||
*/ | ||
export function DoenetExample({ | ||
source, | ||
children, | ||
}: React.PropsWithChildren<{ source: string }>) { | ||
return ( | ||
<div className="doenet-example-container"> | ||
<Tabs items={["Example", "Source"]} defaultIndex={0}> | ||
<Tabs.Tab> | ||
<div className="doenetml-example"> | ||
<DoenetViewer source={source} /> | ||
</div> | ||
</Tabs.Tab> | ||
<Tabs.Tab>{children}</Tabs.Tab> | ||
</Tabs> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,6 +1,38 @@ | ||
import React from "react"; | ||
import dynamic from "next/dynamic"; | ||
import { | ||
DoenetViewer as DoenetViewerOrig, | ||
DoenetEditor as DoenetEditorOrig, | ||
} from "@doenet/doenetml-iframe"; | ||
import "@doenet/virtual-keyboard/style.css"; | ||
|
||
export const DoenetML = dynamic(() => import("./doenetInternal"), { | ||
ssr: false, | ||
}); | ||
/** | ||
* Render DoenetML in an iframe so that its styling/state is completely isolated from the page. | ||
*/ | ||
export function DoenetViewer({ | ||
source, | ||
}: React.PropsWithChildren<{ source: string }>) { | ||
return <DoenetViewerOrig doenetML={source} />; | ||
} | ||
|
||
export function DoenetEditor({ | ||
source, | ||
showFormatter = false, | ||
viewerLocation = "right", | ||
height = "500px", | ||
}: React.PropsWithChildren<{ | ||
source: string; | ||
showFormatter?: boolean; | ||
viewerLocation?: "left" | "right" | "top" | "bottom"; | ||
height?: string; | ||
}>) { | ||
return ( | ||
<div className="doenet-editor-container"> | ||
<DoenetEditorOrig | ||
doenetML={source} | ||
showFormatter={showFormatter} | ||
viewerLocation={viewerLocation} | ||
height={height} | ||
/> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./doenetml-example"; | ||
export * from "./doenet-example"; | ||
export * from "./props-display"; | ||
export * from "./doenet"; |
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
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
2 changes: 1 addition & 1 deletion
2
packages/docs-nextra/pages/reference/doenetML_components/angle.mdx
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
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
Oops, something went wrong.