Skip to content

Commit 7beed27

Browse files
authored
feat: more syntaxes and themes
2 parents 3832ce3 + 02d3ab8 commit 7beed27

File tree

78 files changed

+45632
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+45632
-400
lines changed

.github/workflows/biome-check.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
name: BiomeJS Checks
1+
name: Quality Checks
22

33
on:
44
pull_request:
55
branches: [main]
66

77
jobs:
8+
check:
9+
name: Rust Check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
- name: Set up Rust toolchain
15+
uses: actions-rs/toolchain@v1
16+
with:
17+
toolchain: stable
18+
- name: Check Rust code
19+
run: cd markdown-renderer && cargo check
20+
- name: Run Clippy
21+
run: cd markdown-renderer && cargo clippy -- -D warnings
822
biome:
923
name: Run BiomeJS
1024
runs-on: ubuntu-latest
11-
25+
needs: check
1226
steps:
1327
- name: Checkout code
1428
uses: actions/checkout@v4

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing to `solid-markdown-wasm`
2+
3+
We welcome contributions to `solid-markdown-wasm`! If you have ideas for improvements, bug fixes, or new features, please feel free to contribute.
4+
5+
Here's a general guideline for contributing:
6+
7+
1. **Fork the repository** on GitHub.
8+
2. **Create a new branch** from the `main` branch for your changes.
9+
3. **Make your changes** and ensure they follow the project's coding style and conventions.
10+
4. **Write tests** for any new functionality or bug fixes. Ensure all tests pass.
11+
5. **Commit your changes** with clear and concise commit messages.
12+
6. **Push your branch** to your forked repository.
13+
7. **Create a pull request** to the `main` branch of the original `solid-markdown-wasm` repository.
14+
15+
Please provide a clear description of your changes in the pull request. We will review your contribution as soon as possible.
16+
17+
For significant changes or new features, it's recommended to open an issue first to discuss your ideas with the maintainers. This can help ensure that your work aligns with the project's goals and avoids potential conflicts.
18+
19+
We appreciate your contributions!

README.md

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
- Compliant with [CommonMark 0.31.2](https://spec.commonmark.org/0.31.2/ "commonmark spec")
1717
- Syntax highlighting using [syntect](https://github.com/trishume/syntect "syntect github")
18+
- Huge support for languages and themes
1819
- Easy to use
1920

2021
## Example
@@ -33,33 +34,37 @@ import { type Component, createSignal } from "solid-js";
3334
import { MarkdownRenderer } from "solid-markdown-wasm";
3435

3536
const App: Component = () => {
36-
const [markdown, setMarkdown] = createSignal<string>("# Hello, Markdown!");
37-
38-
const handleInput = (
39-
event: InputEvent & { currentTarget: HTMLTextAreaElement },
40-
) => {
41-
setMarkdown(event.currentTarget.value);
42-
};
43-
44-
return (
45-
<div>
46-
<h1>Markdown Editor</h1>
47-
<textarea
48-
rows={10}
49-
cols={50}
50-
value={markdown()}
51-
onInput={handleInput}
52-
placeholder="Enter your markdown here..."
53-
/>
54-
<h2>Preview:</h2>
55-
<MarkdownRenderer markdown={markdown()} theme="base16-ocean.dark" />
56-
</div>
57-
);
37+
const [markdown, setMarkdown] = createSignal<string>("# Hello, Markdown!");
38+
39+
const handleInput = (
40+
event: InputEvent & { currentTarget: HTMLTextAreaElement }
41+
) => {
42+
setMarkdown(event.currentTarget.value);
43+
};
44+
45+
return (
46+
<div>
47+
<h1>Markdown Editor</h1>
48+
<textarea
49+
rows={10}
50+
cols={50}
51+
value={markdown()}
52+
onInput={handleInput}
53+
placeholder="Enter your markdown here..."
54+
/>
55+
<h2>Preview:</h2>
56+
<MarkdownRenderer markdown={markdown()} theme="base16-ocean-dark" />
57+
</div>
58+
);
5859
};
5960

6061
export default App;
6162
```
6263

64+
## Available Themes and supported Languages
65+
66+
For a list of available themes and languages, please refer to [THEMES_AND_LANGS.md](./THEMES_AND_LANGS.md). Autocomplete is also supported via your IDE as the themes are exported as unions of string literals.
67+
6368
## Internals
6469

6570
Internally, the renderer is implemented using the [comrak](https://github.com/kivikakk/comrak "comrak github") library and then compiled down to webassembly using [wasm-pack](https://github.com/rustwasm/wasm-pack "wasm-pack github")
@@ -95,23 +100,7 @@ npm run build
95100

96101
## Contributing
97102

98-
We welcome contributions to `solid-markdown-wasm`! If you have ideas for improvements, bug fixes, or new features, please feel free to contribute.
99-
100-
Here's a general guideline for contributing:
101-
102-
1. **Fork the repository** on GitHub.
103-
2. **Create a new branch** from the `main` branch for your changes.
104-
3. **Make your changes** and ensure they follow the project's coding style and conventions.
105-
4. **Write tests** for any new functionality or bug fixes. Ensure all tests pass.
106-
5. **Commit your changes** with clear and concise commit messages.
107-
6. **Push your branch** to your forked repository.
108-
7. **Create a pull request** to the `main` branch of the original `solid-markdown-wasm` repository.
109-
110-
Please provide a clear description of your changes in the pull request. We will review your contribution as soon as possible.
111-
112-
For significant changes or new features, it's recommended to open an issue first to discuss your ideas with the maintainers. This can help ensure that your work aligns with the project's goals and avoids potential conflicts.
113-
114-
We appreciate your contributions!
103+
For contributing to `solid-markdown-wasm`, please refer to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for guidelines on how to contribute to this project.
115104

116105
## Support This Project
117106

THEMES_AND_LANGS.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Available Themes
2+
3+
- `1337`
4+
- `OneHalfDark`
5+
- `OneHalfLight`
6+
- `Tomorrow`
7+
- `agola-dark`
8+
- `ascetic-white`
9+
- `axar`
10+
- `ayu-dark`
11+
- `ayu-light`
12+
- `ayu-mirage`
13+
- `base16-atelierdune-light`
14+
- `base16-ocean-dark`
15+
- `base16-ocean-light`
16+
- `bbedit`
17+
- `boron`
18+
- `charcoal`
19+
- `cheerfully-light`
20+
- `classic-modified`
21+
- `demain`
22+
- `dimmed-fluid`
23+
- `dracula`
24+
- `gray-matter-dark`
25+
- `green`
26+
- `gruvbox-dark`
27+
- `gruvbox-light`
28+
- `idle`
29+
- `inspired-github`
30+
- `ir-white`
31+
- `kronuz`
32+
- `material-dark`
33+
- `material-light`
34+
- `monokai`
35+
- `nord`
36+
- `nyx-bold`
37+
- `one-dark`
38+
- `railsbase16-green-screen-dark`
39+
- `solarized-dark`
40+
- `solarized-light`
41+
- `subway-madrid`
42+
- `subway-moscow`
43+
- `two-dark`
44+
- `visual-studio-dark`
45+
- `zenburn`
46+
47+
# Available Languages
48+
49+
- **Plain Text**: `txt`
50+
- **ASP**: `asa`
51+
- **HTML (ASP)**: `asp`
52+
- **ActionScript**: `as`
53+
- **AppleScript**: `applescript`, `script editor`
54+
- **Batch File**: `bat`, `cmd`
55+
- **NAnt Build File**: `build`
56+
- **C#**: `cs`, `csx`
57+
- **C++**: `cpp`, `cc`, `cp`, `cxx`, `c++`, `C`, `h`, `hh`, `hpp`, `hxx`, `h++`, `inl`, `ipp`
58+
- **C**: `c`, `h`
59+
- **CSS**: `css`, `css.erb`, `css.liquid`
60+
- **Clojure**: `clj`, `cljc`, `cljs`, `edn`
61+
- **D**: `d`, `di`
62+
- **DMD Output**:
63+
- **Diff**: `diff`, `patch`
64+
- **Erlang**: `erl`, `hrl`, `Emakefile`, `emakefile`, `escript`
65+
- **HTML (Erlang)**: `yaws`
66+
- **Git Attributes**: `attributes`, `gitattributes`, `.gitattributes`
67+
- **Git Commit**: `COMMIT_EDITMSG`, `MERGE_MSG`, `TAG_EDITMSG`
68+
- **Git Common**:
69+
- **Git Config**: `gitconfig`, `.gitconfig`, `.gitmodules`
70+
- **Git Ignore**: `exclude`, `gitignore`, `.gitignore`
71+
- **Git Link**: `.git`
72+
- **Git Log**: `gitlog`
73+
- **Git Mailmap**: `.mailmap`, `mailmap`
74+
- **Git Rebase Todo**: `git-rebase-todo`
75+
- **Go**: `go`
76+
- **Graphviz (DOT)**: `dot`, `DOT`, `gv`
77+
- **Groovy**: `groovy`, `gvy`, `gradle`, `Jenkinsfile`
78+
- **HTML**: `html`, `htm`, `shtml`, `xhtml`
79+
- **Haskell**: `hs`
80+
- **Literate Haskell**: `lhs`
81+
- **Java Server Page (JSP)**: `jsp`
82+
- **Java**: `java`, `bsh`
83+
- **Javadoc**:
84+
- **Java Properties**: `properties`
85+
- **JSON**: `json`, `sublime-settings`, `sublime-menu`, `sublime-keymap`, `sublime-mousemap`, `sublime-theme`, `sublime-build`, `sublime-project`, `sublime-completions`, `sublime-commands`, `sublime-macro`, `sublime-color-scheme`, `ipynb`, `Pipfile.lock`
86+
- **JavaScript**: `js`, `htc`
87+
- **Regular Expressions (Javascript)**:
88+
- **BibTeX**: `bib`
89+
- **LaTeX Log**:
90+
- **LaTeX**: `tex`, `ltx`
91+
- **TeX**: `sty`, `cls`
92+
- **Lisp**: `lisp`, `cl`, `clisp`, `l`, `mud`, `el`, `scm`, `ss`, `lsp`, `fasl`
93+
- **Lua**: `lua`
94+
- **Make Output**:
95+
- **Makefile**: `make`, `GNUmakefile`, `makefile`, `Makefile`, `makefile.am`, `Makefile.am`, `makefile.in`, `Makefile.in`, `OCamlMakefile`, `mak`, `mk`
96+
- **Markdown**: `md`, `mdown`, `markdown`, `markdn`
97+
- **MultiMarkdown**:
98+
- **MATLAB**: `matlab`
99+
- **OCaml**: `ml`, `mli`
100+
- **OCamllex**: `mll`
101+
- **OCamlyacc**: `mly`
102+
- **camlp4**:
103+
- **Objective-C++**: `mm`, `M`, `h`
104+
- **Objective-C**: `m`, `h`
105+
- **PHP Source**:
106+
- **PHP**: `php`, `php3`, `php4`, `php5`, `php7`, `phps`, `phpt`, `phtml`
107+
- **Regular Expressions (PHP)**:
108+
- **Pascal**: `pas`, `p`, `dpr`
109+
- **Perl**: `pl`, `pc`, `pm`, `pmc`, `pod`, `t`
110+
- **Python**: `py`, `py3`, `pyw`, `pyi`, `pyx`, `pyx.in`, `pxd`, `pxd.in`, `pxi`, `pxi.in`, `rpy`, `cpy`, `SConstruct`, `Sconstruct`, `sconstruct`, `SConscript`, `gyp`, `gypi`, `Snakefile`, `vpy`, `wscript`, `bazel`, `bzl`
111+
- **Regular Expressions (Python)**:
112+
- **R Console**:
113+
- **R**: `R`, `r`, `Rprofile`
114+
- **Rd (R Documentation)**: `rd`
115+
- **HTML (Rails)**: `rails`, `rhtml`, `erb`, `html.erb`
116+
- **JavaScript (Rails)**: `js.erb`
117+
- **Ruby Haml**: `haml`, `sass`
118+
- **Ruby on Rails**: `rxml`, `builder`
119+
- **SQL (Rails)**: `erbsql`, `sql.erb`
120+
- **Regular Expression**: `re`
121+
- **reStructuredText**: `rst`, `rest`
122+
- **Ruby**: `rb`, `Appfile`, `Appraisals`, `Berksfile`, `Brewfile`, `capfile`, `cgi`, `Cheffile`, `config.ru`, `Deliverfile`, `Fastfile`, `fcgi`, `Gemfile`, `gemspec`, `Guardfile`, `irbrc`, `jbuilder`, `Podfile`, `podspec`, `prawn`, `rabl`, `rake`, `Rakefile`, `Rantfile`, `rbx`, `rjs`, `ruby.rail`, `Scanfile`, `simplecov`, `Snapfile`, `thor`, `Thorfile`, `Vagrantfile`
123+
- **Cargo Build Results**:
124+
- **Rust**: `rs`
125+
- **SQL**: `sql`, `ddl`, `dml`
126+
- **Scala**: `scala`, `sbt`, `sc`
127+
- **Bourne Again Shell (bash)**: `sh`, `bash`, `zsh`, `ash`, `.bash_aliases`, `.bash_completions`, `.bash_functions`, `.bash_login`, `.bash_logout`, `.bash_profile`, `.bash_variables`, `.bashrc`, `.profile`, `.textmate_init`, `.zlogin`, `.zlogout`, `.zprofile`, `.zshenv`, `.zshrc`, `PKGBUILD`, `.ebuild`, `.eclass`
128+
- **Shell-Unix-Generic**:
129+
- **commands-builtin-shell-bash**:
130+
- **HTML (Tcl)**: `adp`
131+
- **Tcl**: `tcl`
132+
- **Textile**: `textile`
133+
- **XML**: `xml`, `xsd`, `xslt`, `tld`, `dtml`, `rng`, `rss`, `opml`, `svg`
134+
- **YAML**: `yaml`, `yml`, `sublime-syntax`
135+
- **Assembly x86 (NASM)**: `asm`, `inc`, `nasm`
136+
- **Advanced CSV**: `csv`, `tsv`
137+
- **Crystal**: `cr`
138+
- **Dart**: `dart`
139+
- **Dockerfile**: `Dockerfile`, `dockerfile`
140+
- **GDScript (Godot Engine)**: `gd`
141+
- **GraphQL**: `graphql`, `graphqls`, `gql`
142+
- **Handlebars**: `handlebars`, `handlebars.html`, `hbr`, `hbrs`, `hbs`, `hdbs`, `hjs`, `mu`, `mustache`, `rac`, `stache`, `template`, `tmpl`
143+
- **Julia**: `jl`
144+
- **Kotlin**: `kt`, `kts`
145+
- **Less**: `less`, `css.less`
146+
- **MiniZinc (MZN)**: `mzn`, `dzn`
147+
- **Nim**: `nim`, `nims`
148+
- **Nix**: `nix`
149+
- **PowerShell**: `ps1`, `psm1`, `psd1`
150+
- **SWI-Prolog**: `pro`
151+
- **Racket**: `rkt`
152+
- **Reason**: `re`, `rei`
153+
- **Stylus**: `styl`, `stylus`
154+
- **CMake C Header**: `h.in`
155+
- **CMake C++ Header**: `hh.in`, `hpp.in`, `hxx.in`, `h++.in`
156+
- **CMake**: `CMakeLists.txt`, `cmake`
157+
- **CMakeCache**: `CMakeCache.txt`
158+
- **CMakeCommands**:
159+
- **Generic Config**: `cfg`, `conf`, `config`, `ini`, `pro`, `mak`, `mk`, `Doxyfile`, `inputrc`, `.inputrc`, `dircolors`, `.dircolors`, `gitmodules`, `.gitmodules`, `gitignore`, `.gitignore`, `gitattributes`, `.gitattributes`
160+
- **Elm Compile Messages**:
161+
- **Elm Documentation**:
162+
- **Elm**: `elm`
163+
- **Fortran (Fixed Form)**: `f`, `F`, `f77`, `F77`, `for`, `FOR`, `fpp`, `FPP`
164+
- **Fortran (Modern)**: `f90`, `F90`, `f95`, `F95`, `f03`, `F03`, `f08`, `F08`
165+
- **Fortran Namelist**: `namelist`
166+
- **GFortran Build Results**:
167+
- **OpenMP (Fortran)**:
168+
- **SCSS**: `scss`
169+
- **Sass**: `sass`
170+
- **Linker Script**: `ld`
171+
- **Swift**: `swift`
172+
- **TypeScript**: `ts`
173+
- **TypeScriptReact**: `tsx`
174+
- **VimL**: `vim`
175+
- **AWK**: `awk`
176+
- **Elixir**: `ex`, `exs`
177+
- **HTML (EEx)**: `html.eex`, `html.leex`
178+
- **Regular Expressions (Elixir)**: `ex.re`
179+
- **lrc**: `lrc`, `lyric`
180+
- **Protocol Buffer**: `proto`, `protodevel`
181+
- **Protocol Buffer (TEXT)**: `pb.txt`, `proto.text`, `textpb`, `pbtxt`, `prototxt`
182+
- **srt**: `srt`, `subrip`
183+
- **ClojureC**: `clj`, `cljs`, `cljc`, `cljx`, `boot`
184+
- **EDN**: `edn`
185+
- **Friendly Interactive Shell (fish)**: `fish`
186+
- **GLSL**: `vs`, `fs`, `gs`, `vsh`, `fsh`, `gsh`, `vshader`, `fshader`, `gshader`, `vert`, `frag`, `geom`, `tesc`, `tese`, `comp`, `glsl`
187+
- **HTML (Jinja2)**: `htm.j2`, `html.j2`, `xhtml.j2`, `xml.j2`
188+
- **Jinja2**: `j2`, `jinja2`, `jinja`
189+
- **PureScript**: `purs`
190+
- **Zig**: `zig`
191+
- **TOML**: `toml`, `tml`, `Cargo.lock`, `Gopkg.lock`, `Pipfile`
192+
- **F#**: `fs`, `fsi`, `fsx`

bun.lockb

48 Bytes
Binary file not shown.

example/bun.lockb

-16 Bytes
Binary file not shown.

example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const App: Component = () => {
6666
<div class="m-0 h-full shadow-sm overflow-y-auto p-4 px-6">
6767
<MarkdownRenderer
6868
markdown={debouncedMarkdown()}
69-
theme="base16-ocean.dark"
69+
theme="one-dark"
7070
class="markdown-body"
7171
/>
7272
</div>

0 commit comments

Comments
 (0)