Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/huozhi/remark-sugar-high

Syntax highlighter for markdown code blocks using Sugar High
https://github.com/huozhi/remark-sugar-high

highlight markdown markdown-codeblock remark

Last synced: 2 days ago
JSON representation

Syntax highlighter for markdown code blocks using Sugar High

Awesome Lists containing this project

README

        

# remark-sugar-high

Syntax highlighter for markdown code blocks using [Sugar High](https://sugar-high.vercel.app). This allows syntax highlighting without running any client-side code - other than CSS.

## Installation

```bash
$ npm i -S remark-sugar-high
```

## Usage

Input markdown file:

```
\`\`\`javascript
console.log('Hello World');
\`\`\`
```

Using [remark](https://github.com/remarkjs/remark):

```js
await remark()
.use(require('remark-sugar-high'))
.use(require('remark-html'))
.process(file, (err, file) => console.log(String(file)));
```

Output

```html





console


.


log


(


'


Hello World


'


)


;




;
```

Customize the color theme with sugar-high CSS variables, e.g.:

```css
:root {
--sh-identifier: #354150;
--sh-keyword: #f47067;
--sh-string: #00a99a;
--sh-class: #8d85ff;
--sh-property: #4e8fdf;
--sh-entity: #6eafad;
--sh-jsxliterals: #bf7db6;
--sh-sign: #8996a3;
--sh-comment: #a19595;
}
```

Check [sugar-high highlight-with-css section](https://github.com/huozhi/sugar-high#highlight-with-css) for more details.

## License

MIT