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

Updates in line with inline updates #762

Merged
merged 7 commits into from Feb 17, 2020

Conversation

PaulBunker
Copy link
Contributor

@PaulBunker PaulBunker commented Feb 15, 2020

I've updated this branch with changes that were made in the remark plugin

I've also changed references to 'markdown' because mdx is not markdown and will break if it isn't valid.

Still working on a fix for validation

@PaulBunker PaulBunker requested a review from a team as a code owner February 15, 2020 09:23
@github-actions
Copy link
Contributor

github-actions bot commented Feb 15, 2020

Warnings
⚠️ @tinacms/dev please add to a Milestone before merging
⚠️

gatsby-tinacms-mdx is missing dependencies for the following packages:

  • gatsby

  • react

Modified Packages

The following packages were modified by this pull request:

  • gatsby-tinacms-mdx

Generated by 🚫 dangerJS against c344042

@@ -32,8 +32,8 @@ export const pageQuery = graphql\`
\`
`

export const ERROR_MISSING_MDX_RAW_MARKDOWN =
'useMdxForm(mdx) Required attribute `rawMarkdownBody` was not found on `mdx` node.' +
export const ERROR_MISSING_MDX_RAW_MDX =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps this should be ERROR_MISSING_MDX_RAW_MDX_BODY

Copy link
Contributor

Choose a reason for hiding this comment

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

What about ERROR_MISSING_RAW_MDX_BODY?

yaml.dump(mdx.rawFrontmatter) +
'---\n' +
(mdx.rawMarkdownBody || '')
'---\n' + yaml.dump(mdx.rawFrontmatter) + '---\n' + (mdx.rawMdxBody || '')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Template literal here might be easier to read

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think you're right, this is a bit hard to read 😂

I vote for template literal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Template literals didn't work out because of indentation. Prettier wanted this to be a one liner so I changed it to an array so the formatting is made slightly more obvious.

@@ -53,7 +53,7 @@ export function useMdxForm(
return [mdx, null]
}

validateMdx(mdx)
validateMdxExists(mdx)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rename to checkMDXExists ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me!

Copy link
Contributor

@ncphillips ncphillips left a comment

Choose a reason for hiding this comment

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

One of the most confusing PR titles I've ever read, but the content is clear as day 👍

Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

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

Looks great! Nice work @PaulBunker 🎉🌮

I left comments, most of which were in agreement with the changes you suggested.

@@ -32,8 +32,8 @@ export const pageQuery = graphql\`
\`
`

export const ERROR_MISSING_MDX_RAW_MARKDOWN =
'useMdxForm(mdx) Required attribute `rawMarkdownBody` was not found on `mdx` node.' +
export const ERROR_MISSING_MDX_RAW_MDX =
Copy link
Contributor

Choose a reason for hiding this comment

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

What about ERROR_MISSING_RAW_MDX_BODY?

yaml.dump(mdx.rawFrontmatter) +
'---\n' +
(mdx.rawMarkdownBody || '')
'---\n' + yaml.dump(mdx.rawFrontmatter) + '---\n' + (mdx.rawMdxBody || '')
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think you're right, this is a bit hard to read 😂

I vote for template literal

@@ -53,7 +53,7 @@ export function useMdxForm(
return [mdx, null]
}

validateMdx(mdx)
validateMdxExists(mdx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me!

@ncphillips
Copy link
Contributor

Bad import in useMdxForm

 Error: /home/runner/work/tinacms/tinacms/packages/gatsby-tinacms-mdx/src/useMdxForm.tsx(30,3): semantic error TS2305: Module '"./errors"' has no exported member 'ERROR_MISSING_MDX_RAW_MARKDOWN'.

@PaulBunker
Copy link
Contributor Author

Yes I noticed that last night, Confused why it built for me while I was doing this. Fixed now anyway.

@kendallstrautman kendallstrautman merged commit c671a39 into add-gatsby-mdx-plugin Feb 17, 2020
@kendallstrautman kendallstrautman deleted the update-inline-and-names branch February 17, 2020 22:29
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.

None yet

4 participants