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

Add Helix Editor to the syntax highlighting section #86

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/0.4.0-alpha/getting_started/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ source <(amber comp)

| Icon | Name | Location |
|---|:----:|:-----:|
| ![image](/images/logo-vsc.png) | **VS Code** | [VSC Marketplace](https://marketplace.visualstudio.com/items?itemName=Ph0enixKM.amber-language) or [Our extension repository](https://github.com/amber-lang/vsc-amber-extension) |
| ![image](/images/logo-zed.png) | **Zed** | Zed extensions or [Our extension repository](https://github.com/amber-lang/zed-amber-extension) |
| ![image](/images/logo-vim.png) | **Vim** | [Our extension repository](https://github.com/amber-lang/amber-vim) |
| LOGO:vsc | **VS Code** | [VSC Marketplace](https://marketplace.visualstudio.com/items?itemName=Ph0enixKM.amber-language) or [Our extension repository](https://github.com/amber-lang/vsc-amber-extension) |
| LOGO:zed | **Zed** | Zed extensions or [Our extension repository](https://github.com/amber-lang/zed-amber-extension) |
| LOGO:vim | **Vim** | [Our extension repository](https://github.com/amber-lang/amber-vim) |
| LOGO:hx | **Helix Editor** | [Native](https://docs.helix-editor.com/lang-support.html) |
lens0021 marked this conversation as resolved.
Show resolved Hide resolved
lens0021 marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 4 additions & 3 deletions docs/0.4.1-alpha/getting_started/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ source <(amber comp)

| Icon | Name | Location |
|---|:----:|:-----:|
| ![image](/images/logo-vsc.png) | **VS Code** | [VSC Marketplace](https://marketplace.visualstudio.com/items?itemName=Ph0enixKM.amber-language) or [Our extension repository](https://github.com/amber-lang/vsc-amber-extension) |
| ![image](/images/logo-zed.png) | **Zed** | Zed extensions or [Our extension repository](https://github.com/amber-lang/zed-amber-extension) |
| ![image](/images/logo-vim.png) | **Vim** | [Our extension repository](https://github.com/amber-lang/amber-vim) |
| LOGO:vsc | **VS Code** | [VSC Marketplace](https://marketplace.visualstudio.com/items?itemName=Ph0enixKM.amber-language) or [Our extension repository](https://github.com/amber-lang/vsc-amber-extension) |
| LOGO:zed | **Zed** | Zed extensions or [Our extension repository](https://github.com/amber-lang/zed-amber-extension) |
| LOGO:vim | **Vim** | [Our extension repository](https://github.com/amber-lang/amber-vim) |
| LOGO:hx | **Helix Editor** | [Native](https://docs.helix-editor.com/lang-support.html) |
Binary file added public/images/logo-hx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/components/Markdown/Markdown.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ html[mode="light"] .markdown .light-dark img:last-child {
vertical-align: middle;
}

.markdown .logo {
width: 2rem;
height: 2rem;
}

@keyframes fade {
0% {
mask-size: 0rem 0rem;
Expand Down
7 changes: 7 additions & 0 deletions src/components/Markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ const handleDetails = (text: string): string | null => {
return `<blockquote class="${style.details}">${result}</blockquote>`
}

const handleLogos = (text: string): string | null => {
lens0021 marked this conversation as resolved.
Show resolved Hide resolved
const hasLogo = text.match(/\bLOGO:[a-z]+\b/);
if (!hasLogo) return null
return text.replace(/\bLOGO:([a-z]+)\b/g, `<img src="/images/logo-$1.png" class="${style.logo}" />`)
lens0021 marked this conversation as resolved.
Show resolved Hide resolved
}

// You can override the default renderer to customize the output
class MarkdownRenderer extends Renderer {
heading(text: string, level: number, raw: string): string {
Expand Down Expand Up @@ -68,6 +74,7 @@ class MarkdownRenderer extends Renderer {
}

table(header: string, body: string): string {
body = handleLogos(body) ?? body
return `
<div class="${style['table-wrapper']}">
<table>
Expand Down