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

docs: use rich text formatting in Component API Props description #390

Closed
albertms10 opened this issue Nov 7, 2020 · 3 comments · Fixed by #392
Closed

docs: use rich text formatting in Component API Props description #390

albertms10 opened this issue Nov 7, 2020 · 3 comments · Fixed by #392

Comments

@albertms10
Copy link
Contributor

albertms10 commented Nov 7, 2020

It may be better to parse the description field in the Component API Props documentation to show code text as code instead of `code`:

docs with plain text

docs using code tag

A simple RegExp replace method should be enough, if a string can be parsed as HTML:

"`hasIconOnly` must be set to `true`.".replace(/`(.*?)`/g, "<code>$1</code>");
// Output: "<code>hasIconOnly</code> must be set to <code>true</code>."

So, in ComponentApi.svelte:115,

https://github.com/IBM/carbon-components-svelte/blob/8c304521691c3e25a1670e3f73d18cc9c59ee5cc/docs/src/components/ComponentApi.svelte#L114-L116

line should be appended with the replace method described above:

<div class="description">{@html line.replace(/`(.*?)`/g, "<code>$1</code>")}.</div>
@metonym
Copy link
Collaborator

metonym commented Nov 7, 2020

Noted

@albertms10
Copy link
Contributor Author

May I open a PR?

@metonym
Copy link
Collaborator

metonym commented Nov 7, 2020

Sure

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 a pull request may close this issue.

2 participants