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

[Convert] Add codemod to migrate source to heading component #78

Closed
1 task
roadlittledawn opened this issue Sep 22, 2020 · 3 comments
Closed
1 task
Assignees
Labels
enhancement New feature or request

Comments

@roadlittledawn
Copy link
Contributor

roadlittledawn commented Sep 22, 2020

Summary

Add codemod to migration script that and preserves id attributes from HTML to markdown.

Commonly, content authors add custom ID attributes to <h2> and <h3> elements, which are then used to direct link to that section of the page. We'd like to preserve these IDs on migration.

Acceptance criteria

  • As a developer I can run the migrate script and headings in .mdx files retain the id if it exists

Helpful links

Example: many h2 and h3
Example: h4 inside collapser

@roadlittledawn roadlittledawn added the enhancement New feature or request label Sep 22, 2020
@roadlittledawn roadlittledawn added this to the MMF 3 - Components milestone Sep 22, 2020
@roadlittledawn
Copy link
Contributor Author

roadlittledawn commented Sep 23, 2020

FYR: the syntax for adding the id attribute to a markdown heading is:

## Heading {#heading-id}

@jerelmiller
Copy link
Contributor

Unfortunately MDX v2 does not currently support this syntax. I've opened 2 issues about it:

MDX: mdx-js/mdx#1279
Gatsby: gatsbyjs/gatsby#27120

We'll either need to create our own remark plugin to fix this, or wait until we official support from either gatsby-remark-autolink-headers or @mdx-js/mdx. Judging by this comment I suspect the change will need to happen on the Gatsby end.

This change may or may not happen anytime soon (still waiting to hear back on the Gatsby side). We might consider patching this ourselves in the interim.

@jerelmiller jerelmiller self-assigned this Oct 1, 2020
@jerelmiller
Copy link
Contributor

Moved the custom IDs over to #111. The rest of this ticket is addressed so I'm going to go ahead and consider this done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants