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

Remove highlightjs / prismjs domain-wide in favor of ember-shiki #1959

Closed
NullVoxPopuli opened this issue Aug 27, 2023 · 2 comments
Closed

Comments

@NullVoxPopuli
Copy link
Contributor

NullVoxPopuli commented Aug 27, 2023

Resolves:

Helps with:

Supersedes:


Courtesy of @IgnaceMaes

Docs (which uses the component itself!): https://ember-shiki.pages.dev/
GitHub: https://github.com/IgnaceMaes/ember-shiki

✅ TypeScript and Glint ready
🧵 V2 addon format
🚀 FastBoot support
📦 Lazy loaded packages — minimal impact on initial load
#️⃣ Syntax highlighting for 170+ languages — including .gjs and .gts
🎨 Theme support: 29 included themes — load any external
🔢 Line number support
🔤 Custom fonts — including font ligature support
📋 Copy code to clipboard
🏷️ Code block naming
🗂️ Group code blocks with tabs
✨ Line highlighting
🖌️ Stylable via CSS variables

This is much more sophisticated than what we're doing with highlight / prism, so I think we should use it.

Basically, "for free", we get the JS/TS toggle we want on all the code snippets (just have to write them).

The fastboot support is good.
The theme / etc can change per snippet.

It's very good, and supports everything we need for our future documentation plans, which means we don't have to re-implement all of the above ourselves (which is a huge win, because this stuff is non-trivial).

cc @gitKrystan @wagenet @wycats @mansona 🥳


I know code is authored in markdown, so we can easily support ember-shiki by ripping out our current code-rendering logic / plugin and replacing it with a light-weight plugin that does this transform:

prose prose prose

```{languageTag}
code here
```

prose prose prose

=>

prose prose prose

<CodeBlock @code="code here" @language="{languageTag}" />

prose prose prose

Here is how js/ts or gjs/gts could be supported: https://ember-shiki.pages.dev/#code-groups

image

<CodeGroup @names={{array "gjs" "gts"}} as |Tab|>
  <Tab @name="gjs">
    <CodeBlock
      @code="..."
      @language="gjs"
    />
  </Tab>
  <Tab @name="gts">
    <CodeBlock
      @code="..."
      @language="gts"
    />
  </Tab>
</CodeGroup>

@mansona
Copy link
Member

mansona commented Aug 28, 2023

We discussed this in the learning team meeting and we agreed that this kind of general issue is in RFC territory. We are happy to open smaller issues on smaller sub-projects that will discuss how to proceed 👍

@mansona mansona closed this as completed Aug 28, 2023
@NullVoxPopuli
Copy link
Contributor Author

I thought RFCs were for public-facing changes that impact consumers of ember (and the community)? I saw this change as an "implementation detail" 🤔

is the API of the docs' sites a public / intended-to-be-used-as-public API? 😅

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

No branches or pull requests

2 participants