Skip to content

feat: Add table support and syntax highlights for markdowns #3910

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

Merged
merged 4 commits into from
Sep 6, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

Screen Shot 2022-09-06 at 15 48 37

Screen Shot 2022-09-06 at 15 48 30

These preview images are from a storybook so the background and width can look "ugly".

@BrunoQuaresma BrunoQuaresma self-assigned this Sep 6, 2022
@BrunoQuaresma BrunoQuaresma requested a review from a team as a code owner September 6, 2022 18:50
@BrunoQuaresma BrunoQuaresma requested review from Kira-Pilot and removed request for a team September 6, 2022 18:50
@BrunoQuaresma BrunoQuaresma requested review from a team and jsjoeio and removed request for Kira-Pilot and a team September 6, 2022 18:52
@BrunoQuaresma
Copy link
Collaborator Author

Closes #3896

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.

Nice work!

Comment on lines +32 to +33
// Adding node so the ...props don't have it
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ help me understand this (sorry if it's obvious 😂) we destructure node but don't use it, how come?

does prefixing with _ fix the ESLint warning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we destructure node but don't use it, how come?

Because we are getting the ...props and we don't want props having node.

does prefixing with _ fix the ESLint warning?

Yes, but if I use _node it will return _node not found because _node is not an attribute. I could do node: _node but I think it is more confusing than letting it as it is and adding an ignoring comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahhh okay, that makes sense! Thanks for explaining!

PreTag="div"
{...props}
>
{String(children).replace(/\n$/, "")}
Copy link
Contributor

Choose a reason for hiding this comment

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

How come we have to do this .replace? Is it to remove line breaks or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it is so the highlight component can struct it properly. I got this from the react-markdown docs https://github.com/remarkjs/react-markdown#use-custom-components-syntax-highlight

@bpmct
Copy link
Member

bpmct commented Sep 6, 2022

wohoo! I'm adding tables back to my templates now

@BrunoQuaresma BrunoQuaresma enabled auto-merge (squash) September 6, 2022 22:18
@BrunoQuaresma BrunoQuaresma merged commit b1bdf10 into main Sep 6, 2022
@BrunoQuaresma BrunoQuaresma deleted the bq/3896 branch September 6, 2022 22:20
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