-
Notifications
You must be signed in to change notification settings - Fork 45
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
Render markdown in description fields (fixes #153) #155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, I actually don't have any feedback. :) Merging as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, sorry, there are some changes I'd request (it's been a long day). With regard to ping descriptions, we should also use this component on this page: https://github.com/mozilla/glean-dictionary/blob/main/src/pages/PingDetail.svelte
Also, I think we need to apply this to more than just pings. For example, metrics might have markdown in their descriptions as well. See, for example:
http://localhost:5000/#!/apps/fenix/metrics/metrics.search_count
Pings and metrics are having markdown in their descriptions now. In addition, the markdown is being rendered inline, so pings will no longer have a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good now, thanks!
Thinking about this a bit more, I think we should generalize this to a Markdown
component and use slots, instead of hardcoding a description field . That way you could do something like this just about anywhere:
<Markdown>
This my *markdown* text with a [link](https://mozilla.org)
</Markdown>
Do you mind making the modifications? After that, I'd be very happy to land.
I don't. I think It's a great idea. |
Done! Markdown component is working, I just had to add a text var to work as a fallback for slot on StoryBook. Let me know if everything is OK. |
{/if} | ||
<div class="raw-markdown hidden" bind:this={markdown}> | ||
<slot>{text}</slot> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @alvesitalo! Congratulations on getting this over line. |
This creates a markdown render component and adds a story.
Pull Request checklist
fixes, if applicable)