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

♻️ SSW.Rules | Uses .mdx Files #1523

Closed
4 tasks
tkapa opened this issue Oct 1, 2024 · 11 comments
Closed
4 tasks

♻️ SSW.Rules | Uses .mdx Files #1523

tkapa opened this issue Oct 1, 2024 · 11 comments
Assignees
Labels
TinaCMS Relates to TinaCMS migration Type: Refactor A code quality improvement e.g. Tech debt

Comments

@tkapa
Copy link
Member

tkapa commented Oct 1, 2024

Cc:

Hi

Pain

We want all .md files in Rules.Content to be converted to .mdx. This is so that we can use Blocks from TinaCMS.

Tasks

  • Investigate: Gatsby MDX Plugin with current Gatsby plugins on Rules
  • Convert the Gatsby Site to use .mdx (try to render Rules rule first)
  • Deploy to Staging
  • Test that Rules is backwards compatible with .md files (using SSW.Rules.Content/main)

Thanks!

@tkapa tkapa added the Type: Refactor A code quality improvement e.g. Tech debt label Oct 1, 2024
@tkapa tkapa changed the title ♻️ ♻️ SSW.Rules | Uses .mdx Files Oct 1, 2024
@tkapa tkapa added the TinaCMS Relates to TinaCMS migration label Oct 1, 2024
@tkapa tkapa self-assigned this Oct 1, 2024
@tkapa
Copy link
Member Author

tkapa commented Oct 8, 2024

Update - I started working on this on branch tina/call-mdx Using this guide https://www.gatsbyjs.com/docs/how-to/routing/migrate-remark-to-mdx/

I was able to install the mdx plugin and configure it to use .md or .mdx.

There is a slew of errors that need to be resolved, but hopefully once that's done, we can switch over to using .mdx without much issue.

@Calinator444
Copy link
Member

Update: I'm currently trying to investigate why the parser for gatsby-plugin-mdx is failing to parse the frontmatter for rules. The categories are working fine even though they're using the same characters.

Image

@Calinator444
Copy link
Member

Update on this: regarding my previous comment rules is actually falling over

The source of the problem is somewhere inside of rule.js

@Calinator444
Copy link
Member

I've managed to circumvent the issues occurring when the markdown parser parsed invalid syntax by using the tina parser instead.

@Calinator444
Copy link
Member

Calinator444 commented Oct 16, 2024

I'm having trouble building my dev branch using the main content branch of rules. Just going to document my steps to troubleshoot the issue here

  • I've made sure that there are no categories that are missing the "index" property

  • I've tried removing "index" from the query to ensure it's not the issue

  • I've made sure that Gatsby mdx can handle un-indented values

Image
Figure: Un-indented list in an mdx file

  • I've tried querying while filtering by the file path to ensure the markdown parser does not attempt to search for "index" on markdown files that do not have the prop

Image

Figure: File path filter removed from archived markdown query

@Calinator444
Copy link
Member

I've systematically checked which rules could be causing the issue. I was able to get the site building again after deleting

  1. All rules starting with a
  2. All rules starting with d
  3. all rules starting with a number

@Calinator444
Copy link
Member

I tried rebuilding against branches using the rules I deleted to fix the issue in this comment and the build was successful. This doesn't appear to be a formatting issue from the rules. I'm currently investigating whether or not tina/main can build against the full set of rules to diagnose whether this is an issue with the existing dependency gatsby-source-git perhaps an issue with gatsby-plugin-mdx.

@Calinator444
Copy link
Member

Calinator444 commented Oct 22, 2024

CC: @bradystroud

I created a build separate build pipeline to rule out my machine being the cause of the failed builds.

The build pipeline managed to get further along than I did on my machine without any of the errors from Gatsby source git, but I've encountered an error that's difficult to diagnose. The error occurs after the pages are built in gatsby node.

Image

@Calinator444
Copy link
Member

while working on this PBI I discovered some additional types that tina does not support:

  • link references
    Image

  • lists within block quotes
    Image

  • code blocks within block quotes

Image

@Calinator444
Copy link
Member

Calinator444 commented Oct 29, 2024

The guide isn't done yet. There's some feedback I need to address on the PR tinacms/tina.io#2372.

Here's what I've done so far:

  • I created a repo that people can use to follow the guide.

https://github.com/tinacms/gatsby-mdx-example-blog

  • I created the following issues while creating the guide regarding markdown types Tina wouldn't parse.

tinacms/tinacms#5237
tinacms/tinacms#5235
tinacms/tinacms#5236
tinacms/tinacms#5238

@Calinator444
Copy link
Member

CC: @bradystroud

As per our discussion, we are no longer planning to convert SSW Rules to Gatsby's MDX plugin.

I've instead converted the knowledge I gained while working on this PBI to a guide on tina.io explaining how to convert an existing Gatsby blogs to Tina.

Done Video - https://youtu.be/UD8QvNlQV2w (2m18s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TinaCMS Relates to TinaCMS migration Type: Refactor A code quality improvement e.g. Tech debt
Projects
None yet
Development

No branches or pull requests

3 participants