From 76ed6771ff14b2322234eb5d2afc3e9a174fa4a7 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:50:27 -0600 Subject: [PATCH 01/27] Adding testing zone --- docs/content/_navigation.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/content/_navigation.json b/docs/content/_navigation.json index d36804c69340b..21aa85869c2b7 100644 --- a/docs/content/_navigation.json +++ b/docs/content/_navigation.json @@ -5,6 +5,11 @@ "path": "/getting-started", "isDefaultOpen": true, "children": [ + { + "title": "Testing Zone", + "path": "/getting-started/testing-zone", + "nonMdx": true + }, { "title": "What's Dagster?", "path": "/getting-started/what-why-dagster" From 88b8fa82f2ecde5be6b223e944d853bda3842f8f Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:50:47 -0600 Subject: [PATCH 02/27] Adding testing zone commit 2 --- .../pages/getting-started/testing-zone.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/next/pages/getting-started/testing-zone.md diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md new file mode 100644 index 0000000000000..40837a76632cb --- /dev/null +++ b/docs/next/pages/getting-started/testing-zone.md @@ -0,0 +1,29 @@ +--- +title: The Test Zone +description: Tests for all components and features of markdoc and our custom Markdoc build. +--- + +# Headers + +## Complex Header That You Definitely Want to Use an Anchor Link For {% #complex-header %} + +**Bold** + +_Italic_ + +[Links](/docs/nodes) + +![Images](/logo.svg) + +Lists +- Item 1 +- Item 1 +- Item 1 + +> Quotes + +`Inline code` + +``` +Code fences +``` \ No newline at end of file From cc095c92826de4b745a7d9f83a95c4975efa6a0e Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:45:07 -0600 Subject: [PATCH 03/27] Translated mdx buttons into markdoc component --- docs/next/components/markdoc/Button.tsx | 28 +++++++++++ docs/next/markdoc/config.js | 0 docs/next/markdoc/tags.js | 16 ++++++ .../pages/getting-started/testing-zone.md | 49 ++++++++++++++++++- .../pages/getting-started/testing-zone.mdoc | 39 +++++++++++++++ 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 docs/next/components/markdoc/Button.tsx create mode 100644 docs/next/markdoc/config.js create mode 100644 docs/next/pages/getting-started/testing-zone.mdoc diff --git a/docs/next/components/markdoc/Button.tsx b/docs/next/components/markdoc/Button.tsx new file mode 100644 index 0000000000000..8d04b57e0ae54 --- /dev/null +++ b/docs/next/components/markdoc/Button.tsx @@ -0,0 +1,28 @@ +import cx from 'classnames'; + +export const Button = ({ + link, + style = 'primary', + children, +}: { + children: any; + link: string; + style?: 'primary' | 'secondary' | 'blurple'; +}) => { + return ( +
+ + {children} + +
+ ); +}; diff --git a/docs/next/markdoc/config.js b/docs/next/markdoc/config.js new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 4bc328dddbf66..4fbed91a6c113 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,3 +1,4 @@ +import {Button} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; export const note = { @@ -7,3 +8,18 @@ export const note = { export const warning = { render: Warning, }; + +export const button = { + render: Button, + children: ['text'], + attributes: { + link: { + type: String, + }, + style: { + type: String, + default: 'primary', + matches: ['primary', 'secondary', 'blurple'], + }, + }, +}; diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 40837a76632cb..b9ffd76d1192c 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -26,4 +26,51 @@ Lists ``` Code fences -``` \ No newline at end of file +``` + +## Admonitions + +{% warning %} This is a warning {% /warning %} + +{% note %} This is a note {% /note %} + +## Buttons + +### Default + +`{% button link="https://dog.ceo/" %} Click Me! {% /button %}` + +{% button link="https://dog.ceo/" %} Click Me! {% /button %} + +### Primary + +`{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %}` + +{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} + +### Secondary + +`{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %}` + +{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} + +### Blurple + +` {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} ` + +{% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} + + + +### Don't format the buttons like this! +` {% button link="https://dog.ceo/" %}` + +`Click Me!` + +`{% /button %}` + +Or else they look like this. + +{% button link="https://dog.ceo/" %} +Click Me! +{% /button %} \ No newline at end of file diff --git a/docs/next/pages/getting-started/testing-zone.mdoc b/docs/next/pages/getting-started/testing-zone.mdoc new file mode 100644 index 0000000000000..50094cdb2b7dd --- /dev/null +++ b/docs/next/pages/getting-started/testing-zone.mdoc @@ -0,0 +1,39 @@ +--- +title: The Test Zone +description: Tests for all components and features of markdoc and our custom Markdoc build. +--- + +# Headers + +## Complex Header That You Definitely Want to Use an Anchor Link For {% #complex-header %} + +**Bold** + +_Italic_ + +[Links](/docs/nodes) + +![Images](/logo.svg) + +Lists +- Item 1 +- Item 1 +- Item 1 + +> Quotes + +`Inline code` + +``` +Code fences +``` + +{% warning %} This is a warning {% /warning %} + +{% note %} This is a note {% /note %} + +{% button link="https://dog.ceo/" %} Click Me! {% /button %} + +{% button link="https://dog.ceo/" %} +Click Me! +{% /button %} \ No newline at end of file From c20d8d9f2fc98727ad7ff31c6939326709997dd4 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:31:09 -0600 Subject: [PATCH 04/27] Fixing button issue from last commit. --- docs/next/components/markdoc/Button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/next/components/markdoc/Button.tsx b/docs/next/components/markdoc/Button.tsx index 8d04b57e0ae54..bf8e417330219 100644 --- a/docs/next/components/markdoc/Button.tsx +++ b/docs/next/components/markdoc/Button.tsx @@ -10,7 +10,7 @@ export const Button = ({ style?: 'primary' | 'secondary' | 'blurple'; }) => { return ( -
+
Date: Mon, 22 Apr 2024 17:32:05 -0600 Subject: [PATCH 05/27] Translating checks and crosses components to markdoc. --- docs/next/components/markdoc/CheckCross.tsx | 33 +++++++++++++++++++ docs/next/markdoc/tags.js | 11 +++++++ .../pages/getting-started/testing-zone.md | 21 ++++++++++-- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 docs/next/components/markdoc/CheckCross.tsx diff --git a/docs/next/components/markdoc/CheckCross.tsx b/docs/next/components/markdoc/CheckCross.tsx new file mode 100644 index 0000000000000..37b53ac1fdca1 --- /dev/null +++ b/docs/next/components/markdoc/CheckCross.tsx @@ -0,0 +1,33 @@ +export const Check = () => { + return ( + + + + ); +}; + +export const Cross = () => { + return ( + + + + ); +}; diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 4fbed91a6c113..ceefe72052f17 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,5 +1,6 @@ import {Button} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; +import {Check, Cross} from '../components/markdoc/CheckCross'; export const note = { render: Note, @@ -23,3 +24,13 @@ export const button = { }, }, }; + +export const check = { + render: Check, + selfClosing: true, +}; + +export const cross = { + render: Cross, + selfClosing: true, +}; diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index b9ffd76d1192c..f8376563f182b 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -61,7 +61,7 @@ Code fences {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} - +{% warning %} ### Don't format the buttons like this! ` {% button link="https://dog.ceo/" %}` @@ -73,4 +73,21 @@ Or else they look like this. {% button link="https://dog.ceo/" %} Click Me! -{% /button %} \ No newline at end of file +{% /button %} +{% /warning %} + +## Crosses and Checks +A cross looks like this {% cross /%} and a check looks like this {% check /%}. + +Crosses and checks can also be used in lists: +- {% check /%} Completed task +- {% cross /%} Incomplete task +- {% cross /%} Super Incomplete task + +You can also put crosses and checks into headers + +### This is a header with a check {% check /%} +Which is pretty neat. + +### This is a header with a cross {% cross /%} +Which is also pretty neat \ No newline at end of file From 5a76cbe2da048ea8f736abb64c26817da85b24da Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:32:16 -0600 Subject: [PATCH 06/27] removing duplicate testing zone. --- .../pages/getting-started/testing-zone.mdoc | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 docs/next/pages/getting-started/testing-zone.mdoc diff --git a/docs/next/pages/getting-started/testing-zone.mdoc b/docs/next/pages/getting-started/testing-zone.mdoc deleted file mode 100644 index 50094cdb2b7dd..0000000000000 --- a/docs/next/pages/getting-started/testing-zone.mdoc +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: The Test Zone -description: Tests for all components and features of markdoc and our custom Markdoc build. ---- - -# Headers - -## Complex Header That You Definitely Want to Use an Anchor Link For {% #complex-header %} - -**Bold** - -_Italic_ - -[Links](/docs/nodes) - -![Images](/logo.svg) - -Lists -- Item 1 -- Item 1 -- Item 1 - -> Quotes - -`Inline code` - -``` -Code fences -``` - -{% warning %} This is a warning {% /warning %} - -{% note %} This is a note {% /note %} - -{% button link="https://dog.ceo/" %} Click Me! {% /button %} - -{% button link="https://dog.ceo/" %} -Click Me! -{% /button %} \ No newline at end of file From e1a341ed4d6c97ef111b8758e07855f5186c3eb2 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 25 Apr 2024 23:04:01 -0600 Subject: [PATCH 07/27] Adding Button Containers --- docs/next/components/markdoc/Button.tsx | 8 ++++++++ docs/next/markdoc/tags.js | 17 ++++++++++++++++- docs/next/pages/getting-started/testing-zone.md | 14 ++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/docs/next/components/markdoc/Button.tsx b/docs/next/components/markdoc/Button.tsx index bf8e417330219..d2133c5766504 100644 --- a/docs/next/components/markdoc/Button.tsx +++ b/docs/next/components/markdoc/Button.tsx @@ -1,5 +1,13 @@ import cx from 'classnames'; +export const ButtonContainer = ({children}: {children: any}) => { + return ( +
+ {children} +
+ ); +}; + export const Button = ({ link, style = 'primary', diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index ceefe72052f17..5e609b7716835 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,4 +1,6 @@ -import {Button} from '../components/markdoc/Button'; +import {Tag} from '@markdoc/markdoc'; + +import {Button, ButtonContainer} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; import {Check, Cross} from '../components/markdoc/CheckCross'; @@ -10,6 +12,10 @@ export const warning = { render: Warning, }; +export const buttonContainer = { + render: ButtonContainer, +}; + export const button = { render: Button, children: ['text'], @@ -23,6 +29,15 @@ export const button = { matches: ['primary', 'secondary', 'blurple'], }, }, + transform(node, config) { + console.log(node); + console.log(config); + const attributes = node.transformAttributes(config); + const children = node.transformChildren(config); + console.log(attributes); + console.log(children); + return new Tag('Button', attributes, children); + }, }; export const check = { diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index f8376563f182b..5871b4480b338 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -69,13 +69,15 @@ Code fences `{% /button %}` -Or else they look like this. - -{% button link="https://dog.ceo/" %} -Click Me! -{% /button %} +{% button link="https://dog.ceo/" %} Click Me! {% /button %} +Or else they thrown a hydration error. {% /warning %} +### Button Container +The main use case I've seen for buttons in the docs is basically setting up multiple styling links in a row. Doing this requires putting buttons into a `ButtonContainer` + +{% buttonContainer %} {% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} {% /buttonContainer %} + ## Crosses and Checks A cross looks like this {% cross /%} and a check looks like this {% check /%}. @@ -90,4 +92,4 @@ You can also put crosses and checks into headers Which is pretty neat. ### This is a header with a cross {% cross /%} -Which is also pretty neat \ No newline at end of file +Which is also pretty neat. \ No newline at end of file From 8db59fc594e167d6b6d6cf7935f396006c774b72 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:52:08 -0600 Subject: [PATCH 08/27] Improving button stability. Basically, making it so buttons don't cause that weird hydration issue with Next. --- docs/next/components/markdoc/Button.tsx | 6 ++++-- docs/next/markdoc/tags.js | 9 --------- docs/next/pages/getting-started/testing-zone.md | 4 +++- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/docs/next/components/markdoc/Button.tsx b/docs/next/components/markdoc/Button.tsx index d2133c5766504..68c266857a1d0 100644 --- a/docs/next/components/markdoc/Button.tsx +++ b/docs/next/components/markdoc/Button.tsx @@ -1,9 +1,11 @@ import cx from 'classnames'; +import * as React from 'react'; export const ButtonContainer = ({children}: {children: any}) => { + const buttons = React.Children.toArray(children); return (
- {children} + {...buttons}
); }; @@ -29,7 +31,7 @@ export const Button = ({ style === 'blurple' && 'bg-blurple text-white hover:bg-blurple-darker', )} > - {children} + {React.Children.toArray(children)}
); diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 5e609b7716835..7ea69e7756bf3 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -29,15 +29,6 @@ export const button = { matches: ['primary', 'secondary', 'blurple'], }, }, - transform(node, config) { - console.log(node); - console.log(config); - const attributes = node.transformAttributes(config); - const children = node.transformChildren(config); - console.log(attributes); - console.log(children); - return new Tag('Button', attributes, children); - }, }; export const check = { diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 5871b4480b338..55b197297558c 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -69,7 +69,9 @@ Code fences `{% /button %}` -{% button link="https://dog.ceo/" %} Click Me! {% /button %} +{% button link="https://dog.ceo/" %} +Click Me! +{% /button %} Or else they thrown a hydration error. {% /warning %} From 25288d040154ca80f2c7915848715f38f206272d Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:59:58 -0600 Subject: [PATCH 09/27] Adding badge and image tags --- docs/next/components/markdoc/Badge.tsx | 12 +++++++ docs/next/components/markdoc/Image.tsx | 25 ++++++++++++++ docs/next/markdoc/tags.js | 34 +++++++++++++++++-- .../pages/getting-started/testing-zone.md | 19 +++++++++-- docs/next/util/getColorForString.ts | 20 +++++++++++ 5 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 docs/next/components/markdoc/Badge.tsx create mode 100644 docs/next/components/markdoc/Image.tsx create mode 100644 docs/next/util/getColorForString.ts diff --git a/docs/next/components/markdoc/Badge.tsx b/docs/next/components/markdoc/Badge.tsx new file mode 100644 index 0000000000000..b2d91a97e7dba --- /dev/null +++ b/docs/next/components/markdoc/Badge.tsx @@ -0,0 +1,12 @@ +import {getColorForString} from '../../util/getColorForString'; + +export const Badge = ({text}) => { + const colors = getColorForString(text); + return ( + + {text} + + ); +}; diff --git a/docs/next/components/markdoc/Image.tsx b/docs/next/components/markdoc/Image.tsx new file mode 100644 index 0000000000000..2b6f7c8923825 --- /dev/null +++ b/docs/next/components/markdoc/Image.tsx @@ -0,0 +1,25 @@ +import NextImage from 'next/image'; +import Zoom from 'react-medium-image-zoom'; + +export const Image = ({children, ...props}) => { + /* Only version images when all conditions meet: + * - use component in mdx + * - on non-master version + * - in public/images/ dir + */ + const {src} = props; + if (!src.startsWith('/images/')) { + return ( + + + + ); + } + return ( + + + + + + ); +}; diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 7ea69e7756bf3..27d8f0468b853 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,8 +1,8 @@ -import {Tag} from '@markdoc/markdoc'; - import {Button, ButtonContainer} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; import {Check, Cross} from '../components/markdoc/CheckCross'; +import {Image} from '../components/markdoc/Image'; +import {Badge} from '../components/markdoc/Badge'; export const note = { render: Note, @@ -40,3 +40,33 @@ export const cross = { render: Cross, selfClosing: true, }; + +export const image = { + render: Image, + selfClosing: true, + attributes: { + src: { + type: String, + }, + alt: { + type: String, + }, + width: { + type: Number, + }, + height: { + type: Number, + }, + }, +}; + +export const badge = { + render: Badge, + selfClosing: true, + children: ['text'], + attributes: { + text: { + type: String, + }, + }, +}; \ No newline at end of file diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 55b197297558c..7dce7b25d12ee 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -69,10 +69,11 @@ Code fences `{% /button %}` +It causes an odd formatting issue. + {% button link="https://dog.ceo/" %} Click Me! {% /button %} -Or else they thrown a hydration error. {% /warning %} ### Button Container @@ -94,4 +95,18 @@ You can also put crosses and checks into headers Which is pretty neat. ### This is a header with a cross {% cross /%} -Which is also pretty neat. \ No newline at end of file +Which is also pretty neat. + +## Images +We've got a tag that handles making sure images are pretty, optimized, and accessible. + +`{% image src="/images/some-image.png" width=300 height=200 alt="Text for screenreaders. Usually you want to describe things here." /%}` + + + +{% image src="/images/concepts/assets/asset-activity-observation.png" width=1758 height=1146 alt="Text go here" /%} + + +## Badges + +{% badge text="Badgey the Badger" /%} diff --git a/docs/next/util/getColorForString.ts b/docs/next/util/getColorForString.ts new file mode 100644 index 0000000000000..2629d4ea412db --- /dev/null +++ b/docs/next/util/getColorForString.ts @@ -0,0 +1,20 @@ +function hashCode(str) { + return str + .split('') + .reduce((prevHash, currVal) => ((prevHash << 5) - prevHash + currVal.charCodeAt(0)) | 0, 0); +} + +export const getColorForString = (s: string) => { + const colors = [ + ['bg-yellow-100 text-yellow-800'], + ['bg-green-100 text-green-800'], + ['bg-blue-100 text-blue-800'], + ['bg-red-100 text-red-800'], + ['bg-indigo-100 text-indigo-800'], + ['bg-pink-100 text-pink-800'], + ['bg-purple-100 text-purple-800'], + ['bg-gray-100 text-gray-800'], + ]; + + return colors[Math.abs(hashCode(s)) % colors.length]; +}; From c99c311c49378cf426f7028f00263c5de50ed7f4 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:00:43 -0600 Subject: [PATCH 10/27] Moving around imports to make the linter happy. --- docs/next/markdoc/tags.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 27d8f0468b853..3c35685480da7 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,8 +1,8 @@ +import {Badge} from '../components/markdoc/Badge'; import {Button, ButtonContainer} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; import {Check, Cross} from '../components/markdoc/CheckCross'; import {Image} from '../components/markdoc/Image'; -import {Badge} from '../components/markdoc/Badge'; export const note = { render: Note, From 93d2ef1a6d046a47b2e78a382cd1a45df37d5ba0 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:34:20 -0600 Subject: [PATCH 11/27] Migrating code reference link to Markdoc. --- .../components/markdoc/CodeReferenceLink.tsx | 24 +++++++++++++++++++ docs/next/markdoc/tags.js | 17 ++++++++++++- .../pages/getting-started/testing-zone.md | 6 ++++- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 docs/next/components/markdoc/CodeReferenceLink.tsx diff --git a/docs/next/components/markdoc/CodeReferenceLink.tsx b/docs/next/components/markdoc/CodeReferenceLink.tsx new file mode 100644 index 0000000000000..28db60f0aa6e8 --- /dev/null +++ b/docs/next/components/markdoc/CodeReferenceLink.tsx @@ -0,0 +1,24 @@ +import {LATEST_VERSION} from 'util/version'; + +import React from 'react'; + +export const CodeReferenceLink = ({filePath, isInline, children}) => { + const url = `https://github.com/dagster-io/dagster/tree/${LATEST_VERSION}/${filePath}`; + + if (isInline) { + return {React.Children.toArray(children)}; + } else { + return ( +
+
+ + + +
+
+ You can find the code for this example on Github +
+
+ ); + } +}; diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 3c35685480da7..5afefbbe81e45 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -2,6 +2,7 @@ import {Badge} from '../components/markdoc/Badge'; import {Button, ButtonContainer} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; import {Check, Cross} from '../components/markdoc/CheckCross'; +import {CodeReferenceLink} from '../components/markdoc/CodeReferenceLink'; import {Image} from '../components/markdoc/Image'; export const note = { @@ -69,4 +70,18 @@ export const badge = { type: String, }, }, -}; \ No newline at end of file +}; + +export const codeReferenceLink = { + render: CodeReferenceLink, + children: ['text'], + attributes: { + filePath: { + type: String, + }, + isInline: { + type: Boolean, + default: false, + }, + }, +}; diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 7dce7b25d12ee..39ca421ddaf0b 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -13,7 +13,7 @@ _Italic_ [Links](/docs/nodes) -![Images](/logo.svg) +![Images](/images/concepts/assets/asset-activity-observation.png) Lists - Item 1 @@ -110,3 +110,7 @@ We've got a tag that handles making sure images are pretty, optimized, and acces ## Badges {% badge text="Badgey the Badger" /%} + +## Code Reference Links + +{% codeReferenceLink filePath="examples/deploy_ecs" %}{% /codeReferenceLink %} \ No newline at end of file From 2b4d95bda192b54abd9daa81fe1749d9c957162d Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:02:55 -0600 Subject: [PATCH 12/27] Fixng css for reference tables to prevent overflows. --- .../agents/amazon-ecs/configuration-reference.mdx | 2 +- docs/next/styles/globals.css | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/content/dagster-plus/deployment/agents/amazon-ecs/configuration-reference.mdx b/docs/content/dagster-plus/deployment/agents/amazon-ecs/configuration-reference.mdx index 67e6eb188dfb8..39bad9ed1f086 100644 --- a/docs/content/dagster-plus/deployment/agents/amazon-ecs/configuration-reference.mdx +++ b/docs/content/dagster-plus/deployment/agents/amazon-ecs/configuration-reference.mdx @@ -309,7 +309,7 @@ agent_queues: - Optional arn of the secret to authenticate into your private container registry. This does not apply if you are leveraging ECR for your images, see https://docs.aws.amazon.com/AmazonECS/latest/userguide/private-auth.html. + Optional arn of the secret to authenticate into your private container registry. This does not apply if you are leveraging ECR for your images, see the AWS private auth guide. diff --git a/docs/next/styles/globals.css b/docs/next/styles/globals.css index c07937b1e00e0..07dfd87ffab3b 100644 --- a/docs/next/styles/globals.css +++ b/docs/next/styles/globals.css @@ -589,7 +589,6 @@ pre[class="noop"] { border-radius: 0 !important; } - .n { font-weight: 700; } @@ -604,4 +603,8 @@ pre[class="noop"] { dl, dl * { overflow-wrap: break-word; -} \ No newline at end of file +} + +td { + word-break:break-word +} From 783697463c02928fca380acb8adefb25056563bc Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Tue, 30 Apr 2024 12:46:10 -0600 Subject: [PATCH 13/27] Addressing issue with how Markdoc handles passing components as children discovered during testing. Adding unpackText util Using unpackText util in other markdoc tag components. --- docs/next/components/markdoc/Button.tsx | 4 +++- docs/next/components/markdoc/Callouts.tsx | 5 +++-- docs/next/components/markdoc/CodeReferenceLink.tsx | 3 ++- docs/next/util/unpackText.ts | 13 +++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 docs/next/util/unpackText.ts diff --git a/docs/next/components/markdoc/Button.tsx b/docs/next/components/markdoc/Button.tsx index 68c266857a1d0..0f6bb51776369 100644 --- a/docs/next/components/markdoc/Button.tsx +++ b/docs/next/components/markdoc/Button.tsx @@ -1,3 +1,5 @@ +import {unpackText} from 'util/unpackText'; + import cx from 'classnames'; import * as React from 'react'; @@ -31,7 +33,7 @@ export const Button = ({ style === 'blurple' && 'bg-blurple text-white hover:bg-blurple-darker', )} > - {React.Children.toArray(children)} + {unpackText(children)}
); diff --git a/docs/next/components/markdoc/Callouts.tsx b/docs/next/components/markdoc/Callouts.tsx index b2b33d1b1015f..3f335e2f844f5 100644 --- a/docs/next/components/markdoc/Callouts.tsx +++ b/docs/next/components/markdoc/Callouts.tsx @@ -1,3 +1,4 @@ +import {unpackText} from 'util/unpackText'; // import * as React from 'react'; import Icons from '../Icons'; @@ -41,9 +42,9 @@ const Admonition = ({style, children}) => { }; export const Note = ({children}) => { - return {children}; + return {unpackText(children)}; }; export const Warning = ({children}) => { - return {children}; + return {unpackText(children)}; }; diff --git a/docs/next/components/markdoc/CodeReferenceLink.tsx b/docs/next/components/markdoc/CodeReferenceLink.tsx index 28db60f0aa6e8..43317855278ed 100644 --- a/docs/next/components/markdoc/CodeReferenceLink.tsx +++ b/docs/next/components/markdoc/CodeReferenceLink.tsx @@ -1,3 +1,4 @@ +import {unpackText} from 'util/unpackText'; import {LATEST_VERSION} from 'util/version'; import React from 'react'; @@ -6,7 +7,7 @@ export const CodeReferenceLink = ({filePath, isInline, children}) => { const url = `https://github.com/dagster-io/dagster/tree/${LATEST_VERSION}/${filePath}`; if (isInline) { - return {React.Children.toArray(children)}; + return {unpackText(children)}; } else { return (
diff --git a/docs/next/util/unpackText.ts b/docs/next/util/unpackText.ts new file mode 100644 index 0000000000000..9484a31474138 --- /dev/null +++ b/docs/next/util/unpackText.ts @@ -0,0 +1,13 @@ +import React from 'react'; + +// This utility function is for our Markdoc components. +// This function unpacks the children of the Button component to avoid the hydration error caused by markdoc wraping blocks with an extra

tag. +// The conditional logic is to ensure that it works in all cases rather than just the one where the children are wrapped in a

tag. + +export const unpackText = (children) => { + if (children.type === 'p') { + return [...React.Children.toArray(children.props.children)]; + } else { + return children; + } +}; From c1cd014cfd307d8c8d300d45deaa4ac230bdcf77 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Tue, 30 Apr 2024 12:46:24 -0600 Subject: [PATCH 14/27] Adding reference table component. --- .../components/markdoc/ReferenceTable.tsx | 37 +++++++++++++++++++ docs/next/markdoc/tags.js | 14 +++++++ .../pages/getting-started/testing-zone.md | 29 ++++++++++++++- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 docs/next/components/markdoc/ReferenceTable.tsx diff --git a/docs/next/components/markdoc/ReferenceTable.tsx b/docs/next/components/markdoc/ReferenceTable.tsx new file mode 100644 index 0000000000000..d9482aa91ab16 --- /dev/null +++ b/docs/next/components/markdoc/ReferenceTable.tsx @@ -0,0 +1,37 @@ +import {unpackText} from 'util/unpackText'; + +import React from 'react'; + +export const ReferenceTable = ({children}) => { + return ( + + + + + + + + {children} +
PropertyDescription
+ ); +}; + +export const ReferenceTableItem = ({propertyName, children}) => { + return ( + + + {propertyName} + + {unpackText(children)} + + ); +}; diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 5afefbbe81e45..67d3387dc6f85 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -4,6 +4,7 @@ import {Note, Warning} from '../components/markdoc/Callouts'; import {Check, Cross} from '../components/markdoc/CheckCross'; import {CodeReferenceLink} from '../components/markdoc/CodeReferenceLink'; import {Image} from '../components/markdoc/Image'; +import {ReferenceTable, ReferenceTableItem} from '../components/markdoc/ReferenceTable'; export const note = { render: Note, @@ -85,3 +86,16 @@ export const codeReferenceLink = { }, }, }; + +export const referenceTable = { + render: ReferenceTable, +}; + +export const referenceTableItem = { + render: ReferenceTableItem, + attributes: { + propertyName: { + type: String, + }, + }, +}; diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 39ca421ddaf0b..cb4b17879cb07 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -113,4 +113,31 @@ We've got a tag that handles making sure images are pretty, optimized, and acces ## Code Reference Links -{% codeReferenceLink filePath="examples/deploy_ecs" %}{% /codeReferenceLink %} \ No newline at end of file +{% codeReferenceLink filePath="examples/deploy_ecs" %}{% /codeReferenceLink %} + +## Reference Tables + +{% referenceTable %} +{% referenceTableItem propertyName="isolated_agents.enabled" %} +When enabled, agents are isolated and will not be able to access each +others' resources. See the + +Running multiple agents guide + +for more information. +{% /referenceTableItem %} + +{% referenceTableItem propertyName="Item 2" %} +If the markdown works, we should be able to see it render here. + +- Lists +- **Should** +- *Work* +- Now + +Do They? + +Maybe. +{% /referenceTableItem %} + +{% /referenceTable %} From fc045fa4768e328868ccf143f3473c0be2f794f9 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:06:57 -0600 Subject: [PATCH 15/27] Adding Feature Status Badges. --- docs/next/components/markdoc/Badge.tsx | 12 ------- docs/next/components/markdoc/Badges.tsx | 36 +++++++++++++++++++ docs/next/markdoc/tags.js | 17 ++++++++- .../pages/getting-started/testing-zone.md | 11 +++++- 4 files changed, 62 insertions(+), 14 deletions(-) delete mode 100644 docs/next/components/markdoc/Badge.tsx create mode 100644 docs/next/components/markdoc/Badges.tsx diff --git a/docs/next/components/markdoc/Badge.tsx b/docs/next/components/markdoc/Badge.tsx deleted file mode 100644 index b2d91a97e7dba..0000000000000 --- a/docs/next/components/markdoc/Badge.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import {getColorForString} from '../../util/getColorForString'; - -export const Badge = ({text}) => { - const colors = getColorForString(text); - return ( - - {text} - - ); -}; diff --git a/docs/next/components/markdoc/Badges.tsx b/docs/next/components/markdoc/Badges.tsx new file mode 100644 index 0000000000000..c8b314ef2f55c --- /dev/null +++ b/docs/next/components/markdoc/Badges.tsx @@ -0,0 +1,36 @@ +import {getColorForString} from '../../util/getColorForString'; + +export const Badge = ({text}) => { + const colors = getColorForString(text); + return ( + + {text} + + ); +}; + +export const Experimental = () => { + return ( +

+ (Experimental) +
+ ); +}; + +export const Deprecated = () => { + return ( +
+ (Deprecated) +
+ ); +}; + +export const Legacy = () => { + return ( +
+ (Legacy) +
+ ); +}; diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index 67d3387dc6f85..c6fa1282e57ed 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,4 +1,4 @@ -import {Badge} from '../components/markdoc/Badge'; +import {Badge, Experimental, Deprecated, Legacy} from '../components/markdoc/Badges'; import {Button, ButtonContainer} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; import {Check, Cross} from '../components/markdoc/CheckCross'; @@ -73,6 +73,21 @@ export const badge = { }, }; +export const experimental = { + render: Experimental, + selfClosing: true, +}; + +export const deprecated = { + render: Deprecated, + selfClosing: true, +}; + +export const legacy = { + render: Legacy, + selfClosing: true, +}; + export const codeReferenceLink = { render: CodeReferenceLink, children: ['text'], diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index cb4b17879cb07..404477f0263a8 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -109,7 +109,16 @@ We've got a tag that handles making sure images are pretty, optimized, and acces ## Badges -{% badge text="Badgey the Badger" /%} +`{% badge text="Badgey the Badger" /%}` lets you put a custom badge onto the page like this. {% badge text="Badgey the Badger" /%} + +### API Status Badges +We've also got a bunch of badges that you can use to indicate the level of support an API or feature has. + +There are three types of badges: + +- `{% experimental /%}` {% experimental /%} +- `{% deprecated /%}` {% deprecated /%} +- `{% legacy /%}` {% legacy /%} ## Code Reference Links From 9e7b030c0e4b384f9ba6a3ca78c70a5ccf54c28e Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:13:36 -0600 Subject: [PATCH 16/27] Adding Article Lists --- docs/next/components/markdoc/ArticleList.tsx | 42 +++++++++++++++++++ docs/next/markdoc/tags.js | 18 ++++++++ .../pages/getting-started/testing-zone.md | 13 ++++++ 3 files changed, 73 insertions(+) create mode 100644 docs/next/components/markdoc/ArticleList.tsx diff --git a/docs/next/components/markdoc/ArticleList.tsx b/docs/next/components/markdoc/ArticleList.tsx new file mode 100644 index 0000000000000..0127a710c81f3 --- /dev/null +++ b/docs/next/components/markdoc/ArticleList.tsx @@ -0,0 +1,42 @@ +import {unpackText} from 'util/unpackText'; + +import NextLink from 'next/link'; + +import Link from '../Link'; + +export const ArticleList = ({children}) => { + return ( +
+
+
    + {unpackText(children)} +
+
+
+ ); +}; + +export const ArticleListItem = ({title, href}) => { + return ( +
  • + {href.startsWith('http') ? ( + + {title} + + ) : ( + {title} + )} +
  • + ); +}; diff --git a/docs/next/markdoc/tags.js b/docs/next/markdoc/tags.js index c6fa1282e57ed..c966c6226132b 100644 --- a/docs/next/markdoc/tags.js +++ b/docs/next/markdoc/tags.js @@ -1,3 +1,4 @@ +import {ArticleList, ArticleListItem} from '../components/markdoc/ArticleList'; import {Badge, Experimental, Deprecated, Legacy} from '../components/markdoc/Badges'; import {Button, ButtonContainer} from '../components/markdoc/Button'; import {Note, Warning} from '../components/markdoc/Callouts'; @@ -114,3 +115,20 @@ export const referenceTableItem = { }, }, }; + +export const articleList = { + render: ArticleList, +}; + +export const articleListItem = { + render: ArticleListItem, + selfClosing: true, + attributes: { + title: { + type: String, + }, + href: { + type: String, + }, + }, +}; diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 404477f0263a8..5b3f4436642b0 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -150,3 +150,16 @@ Maybe. {% /referenceTableItem %} {% /referenceTable %} + +## Article Lists + +{% articleList %} + {% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%} + {% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%} + {% articleListItem title="Multi-assets" href="/concepts/assets/multi-assets" /%} + {% articleListItem title="Asset jobs" href="/concepts/assets/asset-jobs" /%} + {% articleListItem title="Asset observations" href="/concepts/assets/asset-observations" /%} + {% articleListItem title="Asset selection syntax" href="/concepts/assets/asset-selection-syntax" /%} + {% articleListItem title="Asset checks" href="/concepts/assets/asset-checks" /%} + {% articleListItem title="External assets (Experimental)" href="/concepts/assets/external-assets" /%} +{% /articleList %} From 8d5a896216666bdd4a44479933009a58bd736224 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:38:24 -0600 Subject: [PATCH 17/27] Committing before I mess with tabs to make reverting easier. --- docs/next/components/markdoc/Tabs.tsx | 135 ++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 docs/next/components/markdoc/Tabs.tsx diff --git a/docs/next/components/markdoc/Tabs.tsx b/docs/next/components/markdoc/Tabs.tsx new file mode 100644 index 0000000000000..821e18639c6cf --- /dev/null +++ b/docs/next/components/markdoc/Tabs.tsx @@ -0,0 +1,135 @@ +import {Tab} from '@headlessui/react'; +import {PersistentTabContext} from 'components/PersistentTabContext'; +import React, {useEffect, useState, useCallback} from 'react'; + +const useHash = (): string => { + const [hash, setHash] = React.useState(() => { + return typeof window === 'undefined' ? '' : window.location.hash; + }); + + useEffect(() => { + if (typeof window === 'undefined') { + return; + } + + const handler = () => { + setHash(window.location.hash); + }; + + window.addEventListener('hashchange', handler); + return () => { + window.removeEventListener('hashchange', handler); + }; + }, []); + + return hash; +}; + +interface TabItem { + name: string; + children: any; +} +export const TabItem = (_: TabItem) => {}; // container to pass through name and children + +function classNames(...classes) { + return classes.filter(Boolean).join(' '); +} + +export const TabGroup: React.FC<{children: any; persistentKey?: string}> = ({ + children, + persistentKey, +}) => { + const [selectedTab, setSelectedTab] = useState(0); + const anchor = useHash(); + + const [anchorsInChildren, setAnchorsInChildren] = useState<{[anchor: string]: number}>({}); + const handleTabs = useCallback((node: HTMLElement) => { + if (!node) { + return; + } + const out = {}; + + // Once the tabs render, get the list of element IDs and the map to the + // tab index they are in + const tabs = node.querySelectorAll("[role='tabpanel']"); + for (let i = 0; i < tabs.length; i++) { + const tab = tabs[i] as HTMLElement; + for (const element of tab.querySelectorAll('[id]')) { + out[element.id] = i; + } + } + setAnchorsInChildren(out); + }, []); + + useEffect(() => { + const anchorWithoutHash = anchor.substring(1); + if (anchorWithoutHash in anchorsInChildren) { + const tabIdx = anchorsInChildren[anchorWithoutHash]; + + // Scroll page to the hash after re-render + setSelectedTab(tabIdx); + setTimeout(() => { + const elem = document.getElementById(anchorWithoutHash); + elem?.scrollIntoView(); + }, 10); + } + }, [anchor, anchorsInChildren]); + + const contents = ( + <> + + {React.Children.map(children, (child, idx) => { + return ( + + classNames( + 'w-full py-3 text-sm font-bold leading-5', + 'focus:outline-none border-gray-200', + selected + ? 'border-b-2 border-primary-500 text-primary-500 bg-gray-150' + : 'border-b hover:border-gray-500 hover:text-gray-700', + ) + } + > + {child?.props?.name} + + ); + })} + + + {React.Children.map(children, (child, idx) => { + // Set unmount={false} to ensure all tabs render (some are hidden) + // this way we can gather all the ids in the tab group + console.log(child); + return ( + + {React.Children.toArray(child.props.children)} + + ); + })} + + + ); + + return ( +
    + {persistentKey ? ( + + {(context) => ( + context.setTabState(persistentKey, idx)} + > + {contents} + + )} + + ) : ( + setSelectedTab(idx)}> + {contents} + + )} +
    + ); +}; From 1bbb9b7bc6745cb2352da607eac067e3776e5dc3 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Tue, 30 Apr 2024 16:54:10 -0600 Subject: [PATCH 18/27] Temporarily removing work on Tabs component. --- docs/next/components/markdoc/Tabs.tsx | 135 -------------------------- 1 file changed, 135 deletions(-) delete mode 100644 docs/next/components/markdoc/Tabs.tsx diff --git a/docs/next/components/markdoc/Tabs.tsx b/docs/next/components/markdoc/Tabs.tsx deleted file mode 100644 index 821e18639c6cf..0000000000000 --- a/docs/next/components/markdoc/Tabs.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import {Tab} from '@headlessui/react'; -import {PersistentTabContext} from 'components/PersistentTabContext'; -import React, {useEffect, useState, useCallback} from 'react'; - -const useHash = (): string => { - const [hash, setHash] = React.useState(() => { - return typeof window === 'undefined' ? '' : window.location.hash; - }); - - useEffect(() => { - if (typeof window === 'undefined') { - return; - } - - const handler = () => { - setHash(window.location.hash); - }; - - window.addEventListener('hashchange', handler); - return () => { - window.removeEventListener('hashchange', handler); - }; - }, []); - - return hash; -}; - -interface TabItem { - name: string; - children: any; -} -export const TabItem = (_: TabItem) => {}; // container to pass through name and children - -function classNames(...classes) { - return classes.filter(Boolean).join(' '); -} - -export const TabGroup: React.FC<{children: any; persistentKey?: string}> = ({ - children, - persistentKey, -}) => { - const [selectedTab, setSelectedTab] = useState(0); - const anchor = useHash(); - - const [anchorsInChildren, setAnchorsInChildren] = useState<{[anchor: string]: number}>({}); - const handleTabs = useCallback((node: HTMLElement) => { - if (!node) { - return; - } - const out = {}; - - // Once the tabs render, get the list of element IDs and the map to the - // tab index they are in - const tabs = node.querySelectorAll("[role='tabpanel']"); - for (let i = 0; i < tabs.length; i++) { - const tab = tabs[i] as HTMLElement; - for (const element of tab.querySelectorAll('[id]')) { - out[element.id] = i; - } - } - setAnchorsInChildren(out); - }, []); - - useEffect(() => { - const anchorWithoutHash = anchor.substring(1); - if (anchorWithoutHash in anchorsInChildren) { - const tabIdx = anchorsInChildren[anchorWithoutHash]; - - // Scroll page to the hash after re-render - setSelectedTab(tabIdx); - setTimeout(() => { - const elem = document.getElementById(anchorWithoutHash); - elem?.scrollIntoView(); - }, 10); - } - }, [anchor, anchorsInChildren]); - - const contents = ( - <> - - {React.Children.map(children, (child, idx) => { - return ( - - classNames( - 'w-full py-3 text-sm font-bold leading-5', - 'focus:outline-none border-gray-200', - selected - ? 'border-b-2 border-primary-500 text-primary-500 bg-gray-150' - : 'border-b hover:border-gray-500 hover:text-gray-700', - ) - } - > - {child?.props?.name} - - ); - })} - - - {React.Children.map(children, (child, idx) => { - // Set unmount={false} to ensure all tabs render (some are hidden) - // this way we can gather all the ids in the tab group - console.log(child); - return ( - - {React.Children.toArray(child.props.children)} - - ); - })} - - - ); - - return ( -
    - {persistentKey ? ( - - {(context) => ( - context.setTabState(persistentKey, idx)} - > - {contents} - - )} - - ) : ( - setSelectedTab(idx)}> - {contents} - - )} -
    - ); -}; From 7ede58f0348ded25d4a722a5f3cd1661ffe8c05b Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Wed, 1 May 2024 09:54:35 -0600 Subject: [PATCH 19/27] Updating testing zone. --- .../pages/getting-started/testing-zone.md | 167 ++++++++++++++---- 1 file changed, 134 insertions(+), 33 deletions(-) diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 5b3f4436642b0..8057520f9c00f 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -3,9 +3,28 @@ title: The Test Zone description: Tests for all components and features of markdoc and our custom Markdoc build. --- -# Headers +# Header 1 -## Complex Header That You Definitely Want to Use an Anchor Link For {% #complex-header %} +## Header 2 + +### Header 3 + +#### Header 4 + +##### Header 5 + +## Regular text + +When the wire was despatched he had a cup of tea; over it he told me of a diary kept by Jonathan Harker when abroad, and gave me a typewritten copy of it, as also of Mrs. Harker's diary at Whitby. "Take these," he said, "and study them well. When I have returned you will be master of all the facts, and we can then better enter on our inquisition. Keep them safe, for there is in them much of treasure. You will need all your faith, even you who have had such an experience as that of to-day. What is here told," he laid his hand heavily and gravely on the packet of papers as he spoke, "may be the beginning of the end to you and me and many another; or it may sound the knell of the Un-Dead who walk the earth. Read all, I pray you, with the open mind; and if you can add in any way to the story here told do so, for it is all-important. You have kept diary of all these so strange things; is it not so? Yes! Then we shall go through all these together when we meet." He then made ready for his departure, and shortly after drove off to Liverpool Street. I took my way to Paddington, where I arrived about fifteen minutes before the train came in. + +## Complex Header Where You Definitely Want to Use an Anchor Link {% #complex-header %} + +``` +## Complex Header Where You Definitely Want to Use an +Anchor Link {\% #complex-header %} +``` + +# Vanilla Markdown Nodes **Bold** @@ -13,6 +32,7 @@ _Italic_ [Links](/docs/nodes) +Vanilla markdown images work, but we should really be using the image tag because it optimizes the images, makes them more accessible, and handles resizing them for us. ![Images](/images/concepts/assets/asset-activity-observation.png) Lists @@ -28,13 +48,67 @@ Lists Code fences ``` +Markdoc doesn't have syntax highlighting out of the box. We're going to need to add that in. When it get's added in, this python code should be beautifully highlighted. + +```python +import random + +def magic_8_ball(): + responses = [ + "As I see it, yes.", + "Ask again later.", + "Better not tell you now.", + "Cannot predict now.", + "Don’t count on it.", + "My reply is no.", + "My sources say no.", + "Outlook not so good.", + "Outlook good.", + "Reply hazy, try again.", + "Yes – definitely.", + "You may rely on it.", + "Absolutely not!", + "Go for it!", + "No way, José!", + "Oh, hell no!", + "Hell yes!", + "Yes, if you believe hard enough.", + "No, but that shouldn't stop you.", + "Why would you even ask that?" + ] + + while True: + question = input("Ask the Magic 8 Ball a question (type 'exit' to quit): ") + if question.lower() == 'exit': + print("Magic 8 Ball has left the chat.") + break + else: + print(random.choice(responses)) + +if __name__ == "__main__": + magic_8_ball() + +``` + +# Custom Markdoc Tags +We've extended markdown with custom tags that let us make the docs richer and more interactive. + ## Admonitions +Two types of admonitions are available. Warnings and notes. + +`{% warning %} This is a warning {% /warning %}` + {% warning %} This is a warning {% /warning %} +`{% note %} This is a note {% /note %}` + {% note %} This is a note {% /note %} ## Buttons +Buttons are basically just links that are styled to look neat to the user and work for making links stand out. + +We have a few different styles of buttons that all do the same thing. ### Default @@ -60,29 +134,13 @@ Code fences {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} - -{% warning %} -### Don't format the buttons like this! -` {% button link="https://dog.ceo/" %}` - -`Click Me!` - -`{% /button %}` - -It causes an odd formatting issue. - -{% button link="https://dog.ceo/" %} -Click Me! -{% /button %} -{% /warning %} - ### Button Container The main use case I've seen for buttons in the docs is basically setting up multiple styling links in a row. Doing this requires putting buttons into a `ButtonContainer` {% buttonContainer %} {% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} {% /buttonContainer %} ## Crosses and Checks -A cross looks like this {% cross /%} and a check looks like this {% check /%}. +You can invoke a cross with this tag `{% cross /}%` and it looks like this {% cross /%}. You can invoke checks with this tag `{% check /}%` and it looks like this {% check /%}. Crosses and checks can also be used in lists: - {% check /%} Completed task @@ -122,37 +180,80 @@ There are three types of badges: ## Code Reference Links -{% codeReferenceLink filePath="examples/deploy_ecs" %}{% /codeReferenceLink %} +Code reference links let you point to a specific file in the codebase. They're useful for linking to examples or reference implementations. + +`{% codeReferenceLink filePath="examples/deploy_ecs" /%}` + +{% codeReferenceLink filePath="examples/deploy_ecs" /%} + + +You can also add text to the link like this: + +`{% codeReferenceLink filePath="examples/deploy_ecs" %}Check out our code on Github.{% /codeReferenceLink %}` + +{% codeReferenceLink filePath="examples/deploy_ecs" %}Check out our code on Github.{% /codeReferenceLink %} ## Reference Tables {% referenceTable %} {% referenceTableItem propertyName="isolated_agents.enabled" %} -When enabled, agents are isolated and will not be able to access each -others' resources. See the - -Running multiple agents guide - -for more information. +The cool thing about these tables that will spare people working with them a lot of grief is that they support vanilla markdown and custom tags while the MDX implementation only supported HTML. + +They still aren't the best thing to work with, but this is a night and day different from having to keep track of raw HTML while authoring. {% /referenceTableItem %} {% referenceTableItem propertyName="Item 2" %} -If the markdown works, we should be able to see it render here. -- Lists -- **Should** -- *Work* -- Now +**Bold** + +_Italic_ + +[Links](/docs/nodes) + +Vanilla markdown images work, but we should really be using the image tag because it optimizes the images, makes them more accessible, and handles resizing them for us. +![Images](/images/concepts/assets/asset-activity-observation.png) + +Lists +- Item 1 +- Item 1 +- Item 1 + +> Quotes -Do They? +`Inline code` -Maybe. +``` +Code fences +``` {% /referenceTableItem %} {% /referenceTable %} ## Article Lists +Authors can use article lists. + +They work like this: +`{% articleList %}` + + `{% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%}` + + `{% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%}` + + `{% articleListItem title="Multi-assets" href="/concepts/assets/multi-assets" /%}` + + `{% articleListItem title="Asset jobs" href="/concepts/assets/asset-jobs" /%}` + + `{% articleListItem title="Asset observations" href="/concepts/assets/asset-observations" /%}` + + `{% articleListItem title="Asset selection syntax" href="/concepts/assets/asset-selection-syntax" /%}` + + `{% articleListItem title="Asset checks" href="/concepts/assets/asset-checks" /%}` + + `{% articleListItem title="External assets (Experimental)" href="/concepts/assets/external-assets" /%}` + +`{% /articleList %}` + {% articleList %} {% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%} {% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%} From d7701cdc2b6eee1fa6cdc983b1f7f998fbade1b6 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Wed, 1 May 2024 10:41:06 -0600 Subject: [PATCH 20/27] Removing test zone and adding markdoc-component-docs --- docs/content/_navigation.json | 5 - docs/markdoc-component-documentation.md | 263 ++++++++++++++++++ .../pages/getting-started/testing-zone.md | 7 - 3 files changed, 263 insertions(+), 12 deletions(-) create mode 100644 docs/markdoc-component-documentation.md diff --git a/docs/content/_navigation.json b/docs/content/_navigation.json index 21aa85869c2b7..d36804c69340b 100644 --- a/docs/content/_navigation.json +++ b/docs/content/_navigation.json @@ -5,11 +5,6 @@ "path": "/getting-started", "isDefaultOpen": true, "children": [ - { - "title": "Testing Zone", - "path": "/getting-started/testing-zone", - "nonMdx": true - }, { "title": "What's Dagster?", "path": "/getting-started/what-why-dagster" diff --git a/docs/markdoc-component-documentation.md b/docs/markdoc-component-documentation.md new file mode 100644 index 0000000000000..b8acc50b58fcc --- /dev/null +++ b/docs/markdoc-component-documentation.md @@ -0,0 +1,263 @@ +--- +title: Authoring Component Examples +description: This page shows off what each of the components we're using in our docs looks like. +--- + +This page contains examples of all of the native Markdoc node and the custom markdoc tags that we are using in our docs. + +To see the rendered version of these tags, move this file into the `next/pages/getting-started` directory, run the local server for the site, and navigate to the `getting-started/markdoc-component-documentation` page in your browser. + +# Header 1 + +## Header 2 + +### Header 3 + +#### Header 4 + +##### Header 5 + +## Regular text + +When the wire was despatched he had a cup of tea; over it he told me of a diary kept by Jonathan Harker when abroad, and gave me a typewritten copy of it, as also of Mrs. Harker's diary at Whitby. "Take these," he said, "and study them well. When I have returned you will be master of all the facts, and we can then better enter on our inquisition. Keep them safe, for there is in them much of treasure. You will need all your faith, even you who have had such an experience as that of to-day. What is here told," he laid his hand heavily and gravely on the packet of papers as he spoke, "may be the beginning of the end to you and me and many another; or it may sound the knell of the Un-Dead who walk the earth. Read all, I pray you, with the open mind; and if you can add in any way to the story here told do so, for it is all-important. You have kept diary of all these so strange things; is it not so? Yes! Then we shall go through all these together when we meet." He then made ready for his departure, and shortly after drove off to Liverpool Street. I took my way to Paddington, where I arrived about fifteen minutes before the train came in. + +## Complex Header Where You Definitely Want to Use an Anchor Link {% #complex-header %} + +``` +## Complex Header Where You Definitely Want to Use an +Anchor Link {\% #complex-header %} +``` + +# Vanilla Markdown Nodes + +**Bold** + +_Italic_ + +[Links](/docs/nodes) + +Vanilla markdown images work, but we should really be using the image tag because it optimizes the images, makes them more accessible, and handles resizing them for us. +![Images](/images/concepts/assets/asset-activity-observation.png) + +Lists +- Item 1 +- Item 1 +- Item 1 + +> Quotes + +`Inline code` + +``` +Code fences +``` + +Markdoc doesn't have syntax highlighting out of the box. We're going to need to add that in. When it get's added in, this python code should be beautifully highlighted. + +```python +import random + +def magic_8_ball(): + responses = [ + "As I see it, yes.", + "Ask again later.", + "Better not tell you now.", + "Cannot predict now.", + "Don’t count on it.", + "My reply is no.", + "My sources say no.", + "Outlook not so good.", + "Outlook good.", + "Reply hazy, try again.", + "Yes – definitely.", + "You may rely on it.", + "Absolutely not!", + "Go for it!", + "No way, José!", + "Oh, hell no!", + "Hell yes!", + "Yes, if you believe hard enough.", + "No, but that shouldn't stop you.", + "Why would you even ask that?" + ] + + while True: + question = input("Ask the Magic 8 Ball a question (type 'exit' to quit): ") + if question.lower() == 'exit': + print("Magic 8 Ball has left the chat.") + break + else: + print(random.choice(responses)) + +if __name__ == "__main__": + magic_8_ball() + +``` + +# Custom Markdoc Tags +We've extended markdown with custom tags that let us make the docs richer and more interactive. + +## Admonitions + +Two types of admonitions are available. Warnings and notes. + +`{% warning %} This is a warning {% /warning %}` + +{% warning %} This is a warning {% /warning %} + +`{% note %} This is a note {% /note %}` + +{% note %} This is a note {% /note %} + +## Buttons +Buttons are basically just links that are styled to look neat to the user and work for making links stand out. + +We have a few different styles of buttons that all do the same thing. + +### Default + +`{% button link="https://dog.ceo/" %} Click Me! {% /button %}` + +{% button link="https://dog.ceo/" %} Click Me! {% /button %} + +### Primary + +`{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %}` + +{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} + +### Secondary + +`{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %}` + +{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} + +### Blurple + +` {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} ` + +{% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} + +### Button Container +The main use case I've seen for buttons in the docs is basically setting up multiple styling links in a row. Doing this requires putting buttons into a `ButtonContainer` + +{% buttonContainer %} {% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} {% /buttonContainer %} + +## Crosses and Checks +You can invoke a cross with this tag `{% cross /}%` and it looks like this {% cross /%}. You can invoke checks with this tag `{% check /}%` and it looks like this {% check /%}. + +Crosses and checks can also be used in lists: +- {% check /%} Completed task +- {% cross /%} Incomplete task +- {% cross /%} Super Incomplete task + +You can also put crosses and checks into headers + +### This is a header with a check {% check /%} +Which is pretty neat. + +### This is a header with a cross {% cross /%} +Which is also pretty neat. + +## Images +We've got a tag that handles making sure images are pretty, optimized, and accessible. + +`{% image src="/images/some-image.png" width=300 height=200 alt="Text for screenreaders. Usually you want to describe things here." /%}` + + + +{% image src="/images/concepts/assets/asset-activity-observation.png" width=1758 height=1146 alt="Text go here" /%} + + +## Badges + +`{% badge text="Badgey the Badger" /%}` lets you put a custom badge onto the page like this. {% badge text="Badgey the Badger" /%} + +### API Status Badges +We've also got a bunch of badges that you can use to indicate the level of support an API or feature has. + +There are three types of badges: + +- `{% experimental /%}` {% experimental /%} +- `{% deprecated /%}` {% deprecated /%} +- `{% legacy /%}` {% legacy /%} + +## Code Reference Links + +Code reference links let you point to a specific file in the codebase. They're useful for linking to examples or reference implementations. + +`{% codeReferenceLink filePath="examples/deploy_ecs" /%}` + +{% codeReferenceLink filePath="examples/deploy_ecs" /%} + +## Reference Tables + +{% referenceTable %} +{% referenceTableItem propertyName="isolated_agents.enabled" %} +The cool thing about these tables that will spare people working with them a lot of grief is that they support vanilla markdown and custom tags while the MDX implementation only supported HTML. + +They still aren't the best thing to work with, but this is a night and day different from having to keep track of raw HTML while authoring. +{% /referenceTableItem %} + +{% referenceTableItem propertyName="Item 2" %} + +**Bold** + +_Italic_ + +[Links](/docs/nodes) + +Vanilla markdown images work, but we should really be using the image tag because it optimizes the images, makes them more accessible, and handles resizing them for us. +![Images](/images/concepts/assets/asset-activity-observation.png) + +Lists +- Item 1 +- Item 1 +- Item 1 + +> Quotes + +`Inline code` + +``` +Code fences +``` +{% /referenceTableItem %} + +{% /referenceTable %} + +## Article Lists + +Authors can use article lists. + +They work like this: +`{% articleList %}` + + `{% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%}` + + `{% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%}` + + `{% articleListItem title="Multi-assets" href="/concepts/assets/multi-assets" /%}` + + `{% articleListItem title="Asset jobs" href="/concepts/assets/asset-jobs" /%}` + + `{% articleListItem title="Asset observations" href="/concepts/assets/asset-observations" /%}` + + `{% articleListItem title="Asset selection syntax" href="/concepts/assets/asset-selection-syntax" /%}` + + `{% articleListItem title="Asset checks" href="/concepts/assets/asset-checks" /%}` + + `{% articleListItem title="External assets (Experimental)" href="/concepts/assets/external-assets" /%}` + +`{% /articleList %}` + +{% articleList %} + {% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%} + {% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%} + {% articleListItem title="Multi-assets" href="/concepts/assets/multi-assets" /%} + {% articleListItem title="Asset jobs" href="/concepts/assets/asset-jobs" /%} + {% articleListItem title="Asset observations" href="/concepts/assets/asset-observations" /%} + {% articleListItem title="Asset selection syntax" href="/concepts/assets/asset-selection-syntax" /%} + {% articleListItem title="Asset checks" href="/concepts/assets/asset-checks" /%} + {% articleListItem title="External assets (Experimental)" href="/concepts/assets/external-assets" /%} +{% /articleList %} diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md index 8057520f9c00f..09526c446fb5f 100644 --- a/docs/next/pages/getting-started/testing-zone.md +++ b/docs/next/pages/getting-started/testing-zone.md @@ -186,13 +186,6 @@ Code reference links let you point to a specific file in the codebase. They're u {% codeReferenceLink filePath="examples/deploy_ecs" /%} - -You can also add text to the link like this: - -`{% codeReferenceLink filePath="examples/deploy_ecs" %}Check out our code on Github.{% /codeReferenceLink %}` - -{% codeReferenceLink filePath="examples/deploy_ecs" %}Check out our code on Github.{% /codeReferenceLink %} - ## Reference Tables {% referenceTable %} From dc5263a22a950bf86c6f84ead9f9c50f2d77646c Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Wed, 1 May 2024 10:41:35 -0600 Subject: [PATCH 21/27] Deleting testing zone --- .../pages/getting-started/testing-zone.md | 259 ------------------ 1 file changed, 259 deletions(-) delete mode 100644 docs/next/pages/getting-started/testing-zone.md diff --git a/docs/next/pages/getting-started/testing-zone.md b/docs/next/pages/getting-started/testing-zone.md deleted file mode 100644 index 09526c446fb5f..0000000000000 --- a/docs/next/pages/getting-started/testing-zone.md +++ /dev/null @@ -1,259 +0,0 @@ ---- -title: The Test Zone -description: Tests for all components and features of markdoc and our custom Markdoc build. ---- - -# Header 1 - -## Header 2 - -### Header 3 - -#### Header 4 - -##### Header 5 - -## Regular text - -When the wire was despatched he had a cup of tea; over it he told me of a diary kept by Jonathan Harker when abroad, and gave me a typewritten copy of it, as also of Mrs. Harker's diary at Whitby. "Take these," he said, "and study them well. When I have returned you will be master of all the facts, and we can then better enter on our inquisition. Keep them safe, for there is in them much of treasure. You will need all your faith, even you who have had such an experience as that of to-day. What is here told," he laid his hand heavily and gravely on the packet of papers as he spoke, "may be the beginning of the end to you and me and many another; or it may sound the knell of the Un-Dead who walk the earth. Read all, I pray you, with the open mind; and if you can add in any way to the story here told do so, for it is all-important. You have kept diary of all these so strange things; is it not so? Yes! Then we shall go through all these together when we meet." He then made ready for his departure, and shortly after drove off to Liverpool Street. I took my way to Paddington, where I arrived about fifteen minutes before the train came in. - -## Complex Header Where You Definitely Want to Use an Anchor Link {% #complex-header %} - -``` -## Complex Header Where You Definitely Want to Use an -Anchor Link {\% #complex-header %} -``` - -# Vanilla Markdown Nodes - -**Bold** - -_Italic_ - -[Links](/docs/nodes) - -Vanilla markdown images work, but we should really be using the image tag because it optimizes the images, makes them more accessible, and handles resizing them for us. -![Images](/images/concepts/assets/asset-activity-observation.png) - -Lists -- Item 1 -- Item 1 -- Item 1 - -> Quotes - -`Inline code` - -``` -Code fences -``` - -Markdoc doesn't have syntax highlighting out of the box. We're going to need to add that in. When it get's added in, this python code should be beautifully highlighted. - -```python -import random - -def magic_8_ball(): - responses = [ - "As I see it, yes.", - "Ask again later.", - "Better not tell you now.", - "Cannot predict now.", - "Don’t count on it.", - "My reply is no.", - "My sources say no.", - "Outlook not so good.", - "Outlook good.", - "Reply hazy, try again.", - "Yes – definitely.", - "You may rely on it.", - "Absolutely not!", - "Go for it!", - "No way, José!", - "Oh, hell no!", - "Hell yes!", - "Yes, if you believe hard enough.", - "No, but that shouldn't stop you.", - "Why would you even ask that?" - ] - - while True: - question = input("Ask the Magic 8 Ball a question (type 'exit' to quit): ") - if question.lower() == 'exit': - print("Magic 8 Ball has left the chat.") - break - else: - print(random.choice(responses)) - -if __name__ == "__main__": - magic_8_ball() - -``` - -# Custom Markdoc Tags -We've extended markdown with custom tags that let us make the docs richer and more interactive. - -## Admonitions - -Two types of admonitions are available. Warnings and notes. - -`{% warning %} This is a warning {% /warning %}` - -{% warning %} This is a warning {% /warning %} - -`{% note %} This is a note {% /note %}` - -{% note %} This is a note {% /note %} - -## Buttons -Buttons are basically just links that are styled to look neat to the user and work for making links stand out. - -We have a few different styles of buttons that all do the same thing. - -### Default - -`{% button link="https://dog.ceo/" %} Click Me! {% /button %}` - -{% button link="https://dog.ceo/" %} Click Me! {% /button %} - -### Primary - -`{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %}` - -{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} - -### Secondary - -`{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %}` - -{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} - -### Blurple - -` {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} ` - -{% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} - -### Button Container -The main use case I've seen for buttons in the docs is basically setting up multiple styling links in a row. Doing this requires putting buttons into a `ButtonContainer` - -{% buttonContainer %} {% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} {% /buttonContainer %} - -## Crosses and Checks -You can invoke a cross with this tag `{% cross /}%` and it looks like this {% cross /%}. You can invoke checks with this tag `{% check /}%` and it looks like this {% check /%}. - -Crosses and checks can also be used in lists: -- {% check /%} Completed task -- {% cross /%} Incomplete task -- {% cross /%} Super Incomplete task - -You can also put crosses and checks into headers - -### This is a header with a check {% check /%} -Which is pretty neat. - -### This is a header with a cross {% cross /%} -Which is also pretty neat. - -## Images -We've got a tag that handles making sure images are pretty, optimized, and accessible. - -`{% image src="/images/some-image.png" width=300 height=200 alt="Text for screenreaders. Usually you want to describe things here." /%}` - - - -{% image src="/images/concepts/assets/asset-activity-observation.png" width=1758 height=1146 alt="Text go here" /%} - - -## Badges - -`{% badge text="Badgey the Badger" /%}` lets you put a custom badge onto the page like this. {% badge text="Badgey the Badger" /%} - -### API Status Badges -We've also got a bunch of badges that you can use to indicate the level of support an API or feature has. - -There are three types of badges: - -- `{% experimental /%}` {% experimental /%} -- `{% deprecated /%}` {% deprecated /%} -- `{% legacy /%}` {% legacy /%} - -## Code Reference Links - -Code reference links let you point to a specific file in the codebase. They're useful for linking to examples or reference implementations. - -`{% codeReferenceLink filePath="examples/deploy_ecs" /%}` - -{% codeReferenceLink filePath="examples/deploy_ecs" /%} - -## Reference Tables - -{% referenceTable %} -{% referenceTableItem propertyName="isolated_agents.enabled" %} -The cool thing about these tables that will spare people working with them a lot of grief is that they support vanilla markdown and custom tags while the MDX implementation only supported HTML. - -They still aren't the best thing to work with, but this is a night and day different from having to keep track of raw HTML while authoring. -{% /referenceTableItem %} - -{% referenceTableItem propertyName="Item 2" %} - -**Bold** - -_Italic_ - -[Links](/docs/nodes) - -Vanilla markdown images work, but we should really be using the image tag because it optimizes the images, makes them more accessible, and handles resizing them for us. -![Images](/images/concepts/assets/asset-activity-observation.png) - -Lists -- Item 1 -- Item 1 -- Item 1 - -> Quotes - -`Inline code` - -``` -Code fences -``` -{% /referenceTableItem %} - -{% /referenceTable %} - -## Article Lists - -Authors can use article lists. - -They work like this: -`{% articleList %}` - - `{% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%}` - - `{% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%}` - - `{% articleListItem title="Multi-assets" href="/concepts/assets/multi-assets" /%}` - - `{% articleListItem title="Asset jobs" href="/concepts/assets/asset-jobs" /%}` - - `{% articleListItem title="Asset observations" href="/concepts/assets/asset-observations" /%}` - - `{% articleListItem title="Asset selection syntax" href="/concepts/assets/asset-selection-syntax" /%}` - - `{% articleListItem title="Asset checks" href="/concepts/assets/asset-checks" /%}` - - `{% articleListItem title="External assets (Experimental)" href="/concepts/assets/external-assets" /%}` - -`{% /articleList %}` - -{% articleList %} - {% articleListItem title="Software-defined Assets" href="/concepts/assets/software-defined-assets" /%} - {% articleListItem title="Graph-backed Assets" href="/concepts/assets/graph-backed-assets" /%} - {% articleListItem title="Multi-assets" href="/concepts/assets/multi-assets" /%} - {% articleListItem title="Asset jobs" href="/concepts/assets/asset-jobs" /%} - {% articleListItem title="Asset observations" href="/concepts/assets/asset-observations" /%} - {% articleListItem title="Asset selection syntax" href="/concepts/assets/asset-selection-syntax" /%} - {% articleListItem title="Asset checks" href="/concepts/assets/asset-checks" /%} - {% articleListItem title="External assets (Experimental)" href="/concepts/assets/external-assets" /%} -{% /articleList %} From a472e482bc6e74edf75c60f5161f343659c6265b Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 2 May 2024 14:48:21 -0600 Subject: [PATCH 22/27] Fixing runtime error from being passed plaintext elements. --- docs/next/util/unpackText.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/next/util/unpackText.ts b/docs/next/util/unpackText.ts index 9484a31474138..cff36304a4beb 100644 --- a/docs/next/util/unpackText.ts +++ b/docs/next/util/unpackText.ts @@ -5,7 +5,8 @@ import React from 'react'; // The conditional logic is to ensure that it works in all cases rather than just the one where the children are wrapped in a

    tag. export const unpackText = (children) => { - if (children.type === 'p') { + console.log(children); + if (children?.type === 'p') { return [...React.Children.toArray(children.props.children)]; } else { return children; From 1f8989ca719bb007588ae3fa86baf6307165efc6 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 2 May 2024 14:50:06 -0600 Subject: [PATCH 23/27] Moving unpack text to Admonition component instead of warning or note. --- docs/next/components/markdoc/Callouts.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/next/components/markdoc/Callouts.tsx b/docs/next/components/markdoc/Callouts.tsx index 3f335e2f844f5..c741c66bd81d7 100644 --- a/docs/next/components/markdoc/Callouts.tsx +++ b/docs/next/components/markdoc/Callouts.tsx @@ -34,7 +34,7 @@ const Admonition = ({style, children}) => {

    - {children} + {unpackText(children)}
    @@ -42,9 +42,9 @@ const Admonition = ({style, children}) => { }; export const Note = ({children}) => { - return {unpackText(children)}; + return {children}; }; export const Warning = ({children}) => { - return {unpackText(children)}; + return {children}; }; From 66be5b597f60af256f4a82a94ceabbcb3d08da2b Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 2 May 2024 15:10:43 -0600 Subject: [PATCH 24/27] Updating component docs to resolve issue and explain block and inline tags. --- docs/markdoc-component-documentation.md | 69 +++++++++++++++++++------ 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/docs/markdoc-component-documentation.md b/docs/markdoc-component-documentation.md index b8acc50b58fcc..b3e2d0302c554 100644 --- a/docs/markdoc-component-documentation.md +++ b/docs/markdoc-component-documentation.md @@ -97,19 +97,38 @@ if __name__ == "__main__": # Custom Markdoc Tags We've extended markdown with custom tags that let us make the docs richer and more interactive. -## Admonitions +{% warning %} +There are two types of tags. +- Inline tags can be used in the middle of a line of and look like this `{% inlineTag %} Inline tag contents {% /inline tags %}` +- Block tags can be used to wrap around a block of content and look like this: + +`{% blockTag %}` + +`Block tag contents` + +`{% /blockTag %}` + +The docs for each tag calls out whether it can be used inline, as a block, or both. + +{% /warning %} + +## Admonitions : Block Two types of admonitions are available. Warnings and notes. `{% warning %} This is a warning {% /warning %}` -{% warning %} This is a warning {% /warning %} +{% warning %} +This is a warning +{% /warning %} `{% note %} This is a note {% /note %}` -{% note %} This is a note {% /note %} +{% note %} +This is a note +{% /note %} -## Buttons +## Button : Block Buttons are basically just links that are styled to look neat to the user and work for making links stand out. We have a few different styles of buttons that all do the same thing. @@ -118,32 +137,50 @@ We have a few different styles of buttons that all do the same thing. `{% button link="https://dog.ceo/" %} Click Me! {% /button %}` -{% button link="https://dog.ceo/" %} Click Me! {% /button %} +{% button link="https://dog.ceo/" %} +Click Me! +{% /button %} ### Primary `{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %}` -{% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} +{% button link="https://dog.ceo/" style="primary" %} +Click Me! +{% /button %} ### Secondary `{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %}` -{% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} +{% button link="https://dog.ceo/" style="secondary" %} +Click Me! +{% /button %} ### Blurple ` {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} ` -{% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} +{% button link="https://dog.ceo/" style="blurple" %} +Click Me! +{% /button %} -### Button Container +### Button Container : Block The main use case I've seen for buttons in the docs is basically setting up multiple styling links in a row. Doing this requires putting buttons into a `ButtonContainer` -{% buttonContainer %} {% button link="https://dog.ceo/" style="primary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="secondary" %} Click Me! {% /button %} {% button link="https://dog.ceo/" style="blurple" %} Click Me! {% /button %} {% /buttonContainer %} - -## Crosses and Checks +{% buttonContainer %} +{% button link="https://dog.ceo/" style="primary" %} +Click Me! +{% /button %} +{% button link="https://dog.ceo/" style="secondary" %} +Click Me! +{% /button %} +{% button link="https://dog.ceo/" style="blurple" %} +Click Me! +{% /button %} +{% /buttonContainer %} + +## Crosses and Checks : Inline You can invoke a cross with this tag `{% cross /}%` and it looks like this {% cross /%}. You can invoke checks with this tag `{% check /}%` and it looks like this {% check /%}. Crosses and checks can also be used in lists: @@ -169,7 +206,7 @@ We've got a tag that handles making sure images are pretty, optimized, and acces {% image src="/images/concepts/assets/asset-activity-observation.png" width=1758 height=1146 alt="Text go here" /%} -## Badges +## Badges : Inline `{% badge text="Badgey the Badger" /%}` lets you put a custom badge onto the page like this. {% badge text="Badgey the Badger" /%} @@ -182,7 +219,7 @@ There are three types of badges: - `{% deprecated /%}` {% deprecated /%} - `{% legacy /%}` {% legacy /%} -## Code Reference Links +## Code Reference Links : Block Code reference links let you point to a specific file in the codebase. They're useful for linking to examples or reference implementations. @@ -190,7 +227,7 @@ Code reference links let you point to a specific file in the codebase. They're u {% codeReferenceLink filePath="examples/deploy_ecs" /%} -## Reference Tables +## Reference Tables : Block {% referenceTable %} {% referenceTableItem propertyName="isolated_agents.enabled" %} @@ -226,7 +263,7 @@ Code fences {% /referenceTable %} -## Article Lists +## Article Lists : Block Authors can use article lists. From 41e3766650b9809f03a2f765942764cc7af01c00 Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Thu, 9 May 2024 10:01:52 -0600 Subject: [PATCH 25/27] Updating Callouts to resolve following defects found in testing. - Icon does not start at top of the page with text. Markdoc changes the order that CSS classes get applied to child elements compared to preexisting MDX approach so some changes are required to make sure the child elements style correctly. - Child text does not receive colors.text style for some element types. - Child text does not receive text-sm class in some cases. The function applyTextStyles addresses this. --- docs/next/components/markdoc/Callouts.tsx | 22 ++++++++++++++++------ docs/next/styles/globals.css | 10 ++++++++++ docs/next/util/unpackText.ts | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/next/components/markdoc/Callouts.tsx b/docs/next/components/markdoc/Callouts.tsx index c741c66bd81d7..98f3e9a67da77 100644 --- a/docs/next/components/markdoc/Callouts.tsx +++ b/docs/next/components/markdoc/Callouts.tsx @@ -1,5 +1,4 @@ -import {unpackText} from 'util/unpackText'; -// import * as React from 'react'; +import * as React from 'react'; import Icons from '../Icons'; @@ -17,14 +16,25 @@ const ADMONITION_STYLES = { icon: Icons.About, }, }; + +const applyTextStyles = (children, colors) => { + return React.Children.map(children, (child) => { + const existingStyles = child.props.className || ''; + const newStyles = `text-sm text-${colors.text} ${existingStyles}`; + return React.cloneElement(child, {className: newStyles}); + }); +}; + const Admonition = ({style, children}) => { const {colors, icon} = ADMONITION_STYLES[style]; + console.log(children); return (
    -
    +
    + {/* Make container for the svg element that aligns it with the top right of the parent flex container */}
    { {icon && icon}
    -
    - {unpackText(children)} +
    +
    {applyTextStyles(children, colors)}
    diff --git a/docs/next/styles/globals.css b/docs/next/styles/globals.css index 07dfd87ffab3b..b7aee0dd3507f 100644 --- a/docs/next/styles/globals.css +++ b/docs/next/styles/globals.css @@ -608,3 +608,13 @@ dl, dl * { td { word-break:break-word } + +/* These classes make sure the .prose p margins don't make the admonition look bad. */ + +.admonition > :first-child { + margin-top: 0; +} + +.admonition > :last-child { + margin-bottom: 0; +} diff --git a/docs/next/util/unpackText.ts b/docs/next/util/unpackText.ts index cff36304a4beb..53fc4bc3aad47 100644 --- a/docs/next/util/unpackText.ts +++ b/docs/next/util/unpackText.ts @@ -5,7 +5,7 @@ import React from 'react'; // The conditional logic is to ensure that it works in all cases rather than just the one where the children are wrapped in a

    tag. export const unpackText = (children) => { - console.log(children); + // console.log(children); if (children?.type === 'p') { return [...React.Children.toArray(children.props.children)]; } else { From 8486b9044abbac578d74d0e4776863ef8516baad Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Wed, 15 May 2024 10:47:40 -0600 Subject: [PATCH 26/27] Revert "Connecting Link ndoe to NextJS's Next Link component" This reverts commit 01203f40804be1cd6d5c494065850f09da019d78. On branch docs/mdx-component-to-markdoc Your branch is up to date with 'origin/docs/mdx-component-to-markdoc'. Changes to be committed: modified: docs/next/markdoc/nodes/index.ts deleted: docs/next/markdoc/nodes/link.markdoc.ts Reverting this commit to have it be a separate pull request for easier reviewing. --- docs/next/markdoc/nodes/index.ts | 1 - docs/next/markdoc/nodes/link.markdoc.ts | 10 ---------- 2 files changed, 11 deletions(-) delete mode 100644 docs/next/markdoc/nodes/link.markdoc.ts diff --git a/docs/next/markdoc/nodes/index.ts b/docs/next/markdoc/nodes/index.ts index 3ced937a1c414..0553cb942c29a 100644 --- a/docs/next/markdoc/nodes/index.ts +++ b/docs/next/markdoc/nodes/index.ts @@ -1,3 +1,2 @@ /* Use this file to export your markdoc nodes */ export * from './heading.markdoc'; -export * from './link.markdoc'; diff --git a/docs/next/markdoc/nodes/link.markdoc.ts b/docs/next/markdoc/nodes/link.markdoc.ts deleted file mode 100644 index 4857248503f38..0000000000000 --- a/docs/next/markdoc/nodes/link.markdoc.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Link from 'next/link'; - -export const link = { - render: Link, - attributes: { - href: { - type: String, - }, - }, -}; From 537c67e1bce23c643305304b85257e4c98e0aaab Mon Sep 17 00:00:00 2001 From: Niko <39569270+nikomancy@users.noreply.github.com> Date: Wed, 22 May 2024 10:31:26 -0600 Subject: [PATCH 27/27] Fixing issues caused by MDX and Markdoc using the same components. --- docs/next/components/markdoc/Callouts.tsx | 1 - docs/next/components/mdx/MDXComponents.tsx | 55 +++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/docs/next/components/markdoc/Callouts.tsx b/docs/next/components/markdoc/Callouts.tsx index 98f3e9a67da77..f042de67aca6c 100644 --- a/docs/next/components/markdoc/Callouts.tsx +++ b/docs/next/components/markdoc/Callouts.tsx @@ -27,7 +27,6 @@ const applyTextStyles = (children, colors) => { const Admonition = ({style, children}) => { const {colors, icon} = ADMONITION_STYLES[style]; - console.log(children); return (

    diff --git a/docs/next/components/mdx/MDXComponents.tsx b/docs/next/components/mdx/MDXComponents.tsx index 2d206a9840ed4..1f591e618604b 100644 --- a/docs/next/components/mdx/MDXComponents.tsx +++ b/docs/next/components/mdx/MDXComponents.tsx @@ -16,7 +16,7 @@ import Zoom from 'react-medium-image-zoom'; import Icons from '../Icons'; import Link from '../Link'; -import {Note, Warning} from '../markdoc/Callouts'; +// import {Note, Warning} from '../markdoc/Callouts'; import 'react-medium-image-zoom/dist/styles.css'; import {RenderedDAG} from './RenderedDAG'; @@ -129,6 +129,59 @@ const PyObject: React.FunctionComponent<{ ); }; +//////////////////////// +// Callouts // +/////////////////////// + +const ADMONITION_STYLES = { + note: { + colors: { + bg: 'primary-100', + borderIcon: 'primary-500', + text: 'gray-900', + }, + icon: Icons.About, + }, + warning: { + colors: {bg: 'yellow-50', borderIcon: 'yellow-400', text: 'yellow-700'}, + icon: Icons.About, + }, +}; + +const Admonition = ({style, children}) => { + const {colors, icon} = ADMONITION_STYLES[style]; + return ( +
    +
    + {/* Make container for the svg element that aligns it with the top right of the parent flex container */} +
    + +
    +
    +
    {children}
    +
    +
    +
    + ); +}; + +export const Note = ({children}) => { + return {children}; +}; + +export const Warning = ({children}) => { + return {children}; +}; + + ////////////////////// // CHECK // //////////////////////