Skip to content

Commit

Permalink
update preprocessor readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycohen committed Sep 10, 2024
1 parent 04d7ca7 commit a0b0efd
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 68 deletions.
10 changes: 10 additions & 0 deletions .changeset/thirty-ways-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'svelte-pp-markdown': patch
'svelte-pp-katex': patch
'svelte-pp-shiki': patch
'@samplekit/preprocess-markdown': patch
'@samplekit/preprocess-katex': patch
'@samplekit/preprocess-shiki': patch
---

update readme
46 changes: 24 additions & 22 deletions packages/preprocess-katex-vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
# KaTeX TextMate Grammar Injection into Svelte Templates
# Syntax Highlighting for Math in Svelte Templates

Accompanies the @samplekit/preprocess-katex npm package to inject syntax highlighting into the Svelte template math blocks.
This extension adds syntax highlighting to – and snippets for – the [@samplekit/preprocess-katex](https://www.npmjs.com/package/@samplekit/preprocess-katex) NPM package.

## Features
The NPM package allows you to write math (via KaTeX) directly in Svelte templates without disrupting other tools like svelte-check, Prettier, ESLint, TypeScript, etc.

- injects [text.tex.latex meta.math.block.latex support.class.math.block.environment.latex]() highlighting into HTML comments inside Svelte markup.
- injects [text.katex scope](https://github.com/yzhang-gh/vscode-markdown/blob/master/syntaxes/katex.tmLanguage.json) into tagged template literals in JS
- adds snippets to make it quicker to generate the required HTML comments.
## Examples

## Svelte HTML Comments
### In Svelte Markup

By using HTML comments, it's trivial to write a preprocessor without running afoul of svelte check, prettier, eslint, typescript, etc.

#### `<!-- \[ \] -->` (KaTeX display mode) and `<!-- \( \) -->` (KaTeX inline mode)

Before
#### Without Extension

<img alt="KaTeX display in HTML comment without extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-katex-vscode/static/demo-comment-katex-before.png" width="300" />

After
#### With Extension

<img alt="KaTeX display in HTML comment with extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-katex-vscode/static/demo-comment-katex.png" width="300" />

## JS/TS Template Literals

A tagged template literal is used to inject KaTeX highlighting into JS.

#### <code>katex\`</code> or <code>latex\`</code> (case insensitive)
### In JS Tagged Template Literal

Before
#### Without Extension

<img alt="KaTeX in template literal without extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-katex-vscode/static/demo-template-katex-before.png" width="300" />

After
#### With Extension

<img alt="KaTeX in template literal with extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-katex-vscode/static/demo-template-katex.png" width="300" />

## Extension
## Supported Syntax

The supported syntax matches that of the NPM package's preprocessor.

In Svelte markup, use `<!-- \[ \] -->` for display mode and `<!-- \( \) -->` for inline mode.

For JS tagged template literals, use <code>katex\`</code> or <code>latex\`</code> (case insensitive).

## Links

> [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-katex)
- [Docs](https://preprocessors.samplekit.dev/docs/math/)
- [Extension on the VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-katex)
- [Extension Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-katex-vscode)
- [Companion NPM Package](https://www.npmjs.com/package/@samplekit/preprocess-katex)
- [Companion Package Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-katex)
16 changes: 10 additions & 6 deletions packages/preprocess-katex/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@

## What is `preprocess-katex`?

`preprocess-katex` is a preprocessor for Svelte which allows you to write KaTeX directly in Svelte templates.
`preprocess-katex` is a preprocessor for Svelte which allows you to write math (via KaTeX) directly in Svelte templates without disrupting other tools like svelte-check, Prettier, ESLint, TypeScript, etc.

It uses HTML comments so you don't have to worry about conflicts with your other tooling.

The [NPM package](https://www.npmjs.com/package/@samplekit/preprocess-katex) has a corresponding [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-katex) to provide semantic highlighting.
This package has a corresponding [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-katex) to provide syntax highlighting.

## Member of the [@samplekit](https://github.com/timothycohen/samplekit) Preprocessor Family.

[Docs available here](https://preprocessors.samplekit.dev/docs/math/).

<img alt="preprocessor family example" src="https://raw.githubusercontent.com/timothycohen/samplekit/main/sites/preprocessor-docs/static/overview-photo-1420w.webp" width="768" />

## Links

- [Docs](https://preprocessors.samplekit.dev/docs/math/)
- [NPM Package](https://www.npmjs.com/package/@samplekit/preprocess-katex)
- [NPM Package Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-katex)
- [Companion VSCode Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-katex)
- [Companion Extension Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-katex-vscode)
31 changes: 17 additions & 14 deletions packages/preprocess-markdown-vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# Markdown TextMate Grammar Injection into Svelte Templates
# Syntax Highlighting for Markdown in Svelte Templates

Accompanies the @samplekit/preprocess-katex npm package to inject syntax highlighting into the Svelte template markdown blocks.
This extension adds syntax highlighting to – and snippets for – the [@samplekit/preprocess-markdown](https://www.npmjs.com/package/@samplekit/preprocess-markdown) NPM package.

## Features
The NPM package allows you to write Markdown (via Marked) directly in Svelte templates without disrupting other tools like svelte-check, Prettier, ESLint, TypeScript, etc.

- injects Markdown highlighting into HTML comments inside Svelte markup.
- adds snippets to make it quicker to generate the required HTML comments.
## Examples

## Svelte HTML Comments
### Without Extension

By using HTML comments, it's trivial to write a preprocessor without running afoul of svelte check, prettier, eslint, typescript, etc.
<img alt="Markdown in HTML comment without extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-markdown-vscode/static/demo-comment-md-before.png" width="300" />

#### `<!-- md-start md-end -->`
### With Extension

Before
<img alt="Markdown in HTML comment with extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-markdown-vscode/static/demo-comment-md.png" width="300" />

<img alt="Markdown in HTML comment without extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-markdown-vscode/static/demo-comment-md-before.png" width="300" />
## Supported Syntax

After
The supported syntax matches that of the NPM package's preprocessor.

<img alt="Markdown in HTML comment with extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-markdown-vscode/static/demo-comment-md.png" width="300" />
In Svelte markup, wrap Markdown with `<!-- md-start md-end -->`.

## Extension
## Links

> [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-markdown)
- [Docs](https://preprocessors.samplekit.dev/docs/markdown/)
- [Extension on the VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-markdown)
- [Extension Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-markdown-vscode)
- [Companion NPM Package](https://www.npmjs.com/package/@samplekit/preprocess-markdown)
- [Companion Package Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-markdown)
16 changes: 10 additions & 6 deletions packages/preprocess-markdown/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@

## What is `preprocess-markdown`?

`preprocess-markdown` is a preprocessor for Svelte which allows you to write Markdown directly in Svelte templates.
`preprocess-markdown` is a preprocessor for Svelte which allows you to write Markdown (via Marked) directly in Svelte templates without disrupting other tools like svelte-check, Prettier, ESLint, TypeScript, etc.

It uses HTML comments so you don't have to worry about conflicts with your other tooling.

The [NPM package](https://www.npmjs.com/package/@samplekit/preprocess-markdown) has a corresponding [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-markdown) to provide semantic highlighting.
This package has a corresponding [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-markdown) to provide syntax highlighting.

## Member of the [@samplekit](https://github.com/timothycohen/samplekit) Preprocessor Family.

[Docs available here](https://preprocessors.samplekit.dev/docs/markdown/).

<img alt="preprocessor family example" src="https://raw.githubusercontent.com/timothycohen/samplekit/main/sites/preprocessor-docs/static/overview-photo-1420w.webp" width="768" />

## Links

- [Docs](https://preprocessors.samplekit.dev/docs/markdown/)
- [NPM Package](https://www.npmjs.com/package/@samplekit/preprocess-markdown)
- [NPM Package Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-markdown)
- [Companion VSCode Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-markdown)
- [Companion Extension Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-markdown-vscode)
31 changes: 17 additions & 14 deletions packages/preprocess-shiki-vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# Codeblock TextMate Grammar Injection into Svelte Templates
# Syntax Highlighting for Decorated Code Blocks in Svelte Templates

Accompanies the @samplekit/preprocess-shiki npm package to inject syntax highlighting into the Svelte template code blocks.
This extension adds syntax highlighting to – and snippets for – the [@samplekit/preprocess-shiki](https://www.npmjs.com/package/@samplekit/preprocess-shiki) NPM package.

## Features
The NPM package allows you to write decorated code blocks (via Shiki) directly in Svelte templates without disrupting other tools like svelte-check, Prettier, ESLint, TypeScript, etc.

- injects code highlighting into HTML comments inside Svelte markup.
- adds snippets to make it quicker to generate the required HTML comments.
## Examples

## Svelte HTML Comments
### Without Extension

By using HTML comments, it's trivial to write a preprocessor without running afoul of svelte check, prettier, eslint, typescript, etc.
<img alt="Codeblock in HTML comment without extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-shiki-vscode/static/demo-comment-code-before.png" width="300" />

#### `<!-- shiki-start shiki-end -->`
### With Extension

Before
<img alt="Codeblock in HTML comment with extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-shiki-vscode/static/demo-comment-code.png" width="300" />

<img alt="Codeblock in HTML comment without extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-shiki-vscode/static/demo-comment-code-before.png" width="300" />
## Supported Syntax

After
The supported syntax matches that of the NPM package's preprocessor.

<img alt="Codeblock in HTML comment with extension." src="https://raw.githubusercontent.com/timothycohen/samplekit/main/packages/preprocess-shiki-vscode/static/demo-comment-code.png" width="300" />
In Svelte markup, wrap blocks with `<!-- shiki-start shiki-end -->` and one liners with `<!-- shiki-svelte shiki-svelte -->`, `<!-- shiki-html shiki-html -->`, etc.

## Extension
## Links

> [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-shiki)
- [Docs](https://preprocessors.samplekit.dev/docs/code-decoration/)
- [Extension on the VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-shiki)
- [Extension Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-shiki-vscode)
- [Companion NPM Package](https://www.npmjs.com/package/@samplekit/preprocess-shiki)
- [Companion Package Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-shiki)
16 changes: 10 additions & 6 deletions packages/preprocess-shiki/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@

## What is `preprocess-shiki`?

`preprocess-shiki` is a preprocessor for Svelte which allows you to write Shiki code blocks directly in Svelte templates.
`preprocess-shiki` is a preprocessor for Svelte which allows you to write decorated code blocks (via Shiki) directly in Svelte templates without disrupting other tools like svelte-check, Prettier, ESLint, TypeScript, etc.

It uses HTML comments so you don't have to worry about conflicts with your other tooling.

The [NPM package](https://www.npmjs.com/package/@samplekit/preprocess-shiki) has a corresponding [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-shiki) to provide semantic highlighting.
This package has a corresponding [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-shiki) to provide syntax highlighting.

## Member of the [@samplekit](https://github.com/timothycohen/samplekit) Preprocessor Family.

[Docs available here](https://preprocessors.samplekit.dev/docs/code-decoration/).

<img alt="preprocessor family example" src="https://raw.githubusercontent.com/timothycohen/samplekit/main/sites/preprocessor-docs/static/overview-photo-1420w.webp" width="768" />

## Links

- [Docs](https://preprocessors.samplekit.dev/docs/code-decoration/)
- [NPM Package](https://www.npmjs.com/package/@samplekit/preprocess-shiki)
- [NPM Package Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-shiki)
- [Companion VSCode Extension](https://marketplace.visualstudio.com/items?itemName=samplekit.svelte-pp-shiki)
- [Companion Extension Source](https://github.com/timothycohen/samplekit/tree/main/packages/preprocess-shiki-vscode)

0 comments on commit a0b0efd

Please sign in to comment.