Skip to content

Icons - #1413

Merged
reakaleek merged 17 commits into
mainfrom
feature/icons
Jun 30, 2025
Merged

Icons#1413
reakaleek merged 17 commits into
mainfrom
feature/icons

Conversation

@reakaleek

@reakaleek reakaleek commented Jun 23, 2025

Copy link
Copy Markdown
Member

Closes #409

Changes

Notes

  • Using the syntax :icon-name: did not fully work as expected. Especially, in cases where the icon would be the first element in a list or other v3 markdown items.
    I suspect it's conflicting with the :::{} blocks and :option: syntax.

Future improvements

Somehow automatically copy the files from https://github.com/elastic/eui/tree/main/packages/eui/src/components/icon/svgs during the build process.

Preview

image

https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/1413/syntax/icons

@reakaleek
reakaleek requested review from a team as code owners June 23, 2025 09:38
Comment thread docs/syntax/icons.md Outdated
Comment thread docs/syntax/icons.md Outdated
Comment thread docs/syntax/icons.md
Comment thread src/Elastic.Markdown/Myst/InlineParsers/Icon/IconRenderer.cs Outdated
reakaleek and others added 2 commits June 23, 2025 11:47
Co-authored-by: Fabrizio Ferri-Benedetti <fabri.ferribenedetti@elastic.co>
Co-authored-by: Fabrizio Ferri-Benedetti <fabri.ferribenedetti@elastic.co>

@Mpdreamz Mpdreamz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It'd be great if we can get :icon: to work to match Github flavored markdown.

I can take a stab at that in a follow up if needed?

Otherwise we need a clear new syntax i:<icon>: is not quite it!

Other than that love this!

@reakaleek

reakaleek commented Jun 23, 2025

Copy link
Copy Markdown
Member Author

It'd be great if we can get :icon: to work to match Github flavored markdown.

I can take a stab at that in a follow up if needed?

Otherwise we need a clear new syntax i:<icon>: is not quite it!

Other than that love this!

I got it working. Let me know what you think.

e45efec

The main change is in the src/Elastic.Markdown/Myst/Directives/DirectiveParagraphParser.cs

But I'm actually worried, this will have other unintended sideeffects. E.g. if a directive option has the same name as an icon.

IMO, the safest option is another syntax.

Looking at the Myst documentation the most logical syntax would be:

{icon}`icon-name`

@reakaleek
reakaleek requested a review from Mpdreamz June 29, 2025 16:30
# Conflicts:
#	src/Elastic.Markdown/Myst/Renderers/SectionedHeadingRenderer.cs
@reakaleek reakaleek self-assigned this Jun 29, 2025
@reakaleek reakaleek changed the title PoC: Icons Icons Jun 29, 2025
Comment thread docs/_docset.yml

@cotti cotti Jun 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Not an issue in the PR, but in GH) What a weird false positive... If you open this in a hex editor, U+2009 (0xE2 0x80 0x89) is nowhere to be seen.

@reakaleek reakaleek Jun 30, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, you mean the error in the failing test. I was not able to find a difference and I don't think this error will cause any troubles in production.

We might feel the pain when we add tests in the future 😅

But I think the simplified test is testing the necessary parts. Which is fine.

Thank you for checking.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you're referring to the docs-build hints, it's not a false positive, the character really is invisible. It should be a space or not a space. Easy to catch with a regex such as \u2009 if I remember well. I fixed most of those in another PR, so a rebase should do the trick.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No. I had a test that was failing only in windows.

The error said that the output doesn't match the expected. But it was exactly the same.

Hence, @cotti suspected that there must be a weird space or something.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah sorry, I actually misunderstood this haha :D

Comment thread src/Elastic.Markdown/Myst/Roles/RoleParser.cs
public class IconRoleHtmlRenderer : HtmlObjectRenderer<IconsRole>
{

[SuppressMessage("Reliability", "CA2012:Use ValueTasks correctly")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the Suppress is not needed anymore here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh. Thanks!

The copy-pasta syndrome (:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@cotti cotti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚂

@reakaleek
reakaleek merged commit e19ef30 into main Jun 30, 2025
15 checks passed
@reakaleek
reakaleek deleted the feature/icons branch June 30, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create syntax for icons

4 participants