Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with-markdoc example #1

Closed
wants to merge 3 commits into from

Conversation

hideokamoto
Copy link
Collaborator

  • Added nodes example
  • Added tags example
  • Added functions example
  • TypeScript support

Please feel free to merge this PR and mention it to the Next.js maintainers.

Thanks.

Copy link
Owner

@mfix-stripe mfix-stripe left a comment

Choose a reason for hiding this comment

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

PTAL @hideokamoto 🙏

@@ -4,20 +4,27 @@ This example shows using [Markdoc](https://github.com/markdoc/markdoc) as top le

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/markdoc)
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-markdoc)
Copy link
Owner

Choose a reason for hiding this comment

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

@hideokamoto I think I would prefer that these files are under markdoc/, not with-markdoc/

Choose a reason for hiding this comment

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

In the Next.js examples dir, all integration examples names start from with-XXX.

  • with-electron
  • with-firebase
  • with-stripe-typescript
  • etc...

So I think with-markdoc is better.

@@ -0,0 +1,6 @@
export const upper = {
Copy link
Owner

Choose a reason for hiding this comment

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

Can we keep the example even more minimal?

/* Use this file to export your markdoc functions */

@@ -0,0 +1,26 @@
/* Use this file to export your markdoc nodes */
const { nodes } = require('@markdoc/markdoc')
Copy link
Owner

Choose a reason for hiding this comment

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

Can we keep this file even more minimal? How I had it before.

@@ -0,0 +1,44 @@
const TYPE_MAP = {
Copy link
Owner

Choose a reason for hiding this comment

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

Can we keep this file even more minimal? How I had it before.

* @see https://markdoc.io/docs/nextjs#options
*/
mode: 'server', // 'static' | 'server',
//schemaPath: path.join(__dirname, 'markdoc')
Copy link
Owner

Choose a reason for hiding this comment

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

Please remove the options here. We want static (the default). We also should remove the commented out schemaPath

I like the @see comment you have here

mode: 'server', // 'static' | 'server',
//schemaPath: path.join(__dirname, 'markdoc')
})({
pageExtensions: ['js', 'tsx', 'md'],
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
pageExtensions: ['js', 'tsx', 'md'],
pageExtensions: ['js', 'ts', 'md', 'mdoc']

Choose a reason for hiding this comment

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

What's mdoc?
I can't find any file like .mdoc.
If we don't use this file extensions, we should remove it.

And also we must remain tsx, because we're using this extension in pages/_app.tsx

@@ -1,4 +1,5 @@
{
"name": "with-markdoc",
Copy link
Owner

Choose a reason for hiding this comment

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

We can just remove this name I think

@@ -0,0 +1,6 @@
import type { AppProps } from 'next/app'
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need this _app?

Choose a reason for hiding this comment

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

For import '../public/globals.css'.

@@ -16,3 +16,15 @@ If you want to get started right away with this boilerplate, either clone the [G
## Get started from scratch

If you'd prefer to start from scratch, feel free to check out the [official repository](https://github.com/markdoc/markdoc) and [documentation site](https://markdoc.io/docs/getting-started).

## Custom Tag and node examples
Copy link
Owner

Choose a reason for hiding this comment

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

I would remove this too

@hideokamoto-stripe
Copy link

@mfix-stripe
Could you tell me why we need to more minimal?
First time I see the example in the Markdoc org, it was hard to understand how can we use the tag and node, functions feature.
So I'd like to show how can we use these feature.

@mfix-stripe
Copy link
Owner

@mfix-stripe Could you tell me why we need to more minimal? First time I see the example in the Markdoc org, it was hard to understand how can we use the tag and node, functions feature. So I'd like to show how can we use these feature.

@hideokamoto we should explain how to use these features in the docs (https://markdoc.io/docs). The boilerplate should be minimal so folks can get up and running immediately, without having to delete a bunch of stuff we don't need.

@charliegerard-stripe already created a Next.js boilerplate for us, which I'm happy with: https://github.com/markdoc/next.js-starter

@hideokamoto
Copy link
Collaborator Author

Your branch seems already updated to add the TypeScript feature.
So this PR and work was going unnecessary.

@hideokamoto hideokamoto deleted the hideokamoto/mfix/with-markdoc branch May 18, 2022 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants