Skip to content

Commit

Permalink
0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
henrmota committed Oct 22, 2024
1 parent 19fed03 commit bf1f002
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 6 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm
- run: pnpm install
- run: npm version patch
- name: Commit changes if any
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if [[ `git status --porcelain` ]]; then
git add .
git commit -m "Auto-commit: Save uncommitted changes before versioning"
fi
- run: npm version patch -m "Upgrade version to %s [skip ci]"


- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shiki-mdx",
"version": "0.0.1",
"name": "@henrmota/shiki-mdx",
"version": "0.0.2",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -19,9 +19,12 @@
},
"sideEffects": false,
"type": "module",
"keywords": [],
"author": "",
"license": "ISC",
"keywords": [
"shiki",
"mdx-remote"
],
"author": "Henrique Mota",
"license": "MIT",
"description": "",
"devDependencies": {
"@types/jest": "^29.5.13",
Expand Down
57 changes: 57 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# @henmota/shiki-mdx

A plugin for MDX that utilizes Shiki for syntax highlighting. This package is designed to be used in conjunction with Next.js and the `remote-mdx` library.

## Installation

To install the package, you can use npm or yarn. Make sure to also install Shiki as a peer dependency.

```bash
npm install @henmota/shiki-mdx shiki
```

## Usage

```js
import { compileMDX } from "remote-mdx";
import { remarkShikiMdx } from "@henmota/shiki-mdx";
import remarkMath from "remark-math";
import remarkGfm from "remark-gfm";
import rehypeKatex from "rehype-katex";
import rehypeRaw from "rehype-raw";

const content = `
# Your MDX Content Here
\`\`\`js
console.log('Hello, world!');
\`\`\`
`;

const components = {}; // Your custom components

const { frontmatter, mdxContent } = await compileMDX({
source: content,
components: { ...defaultComponents, ...components },
options: {
mdxOptions: {
remarkPlugins: [
remarkMath,
remarkGfm,
[remarkShikiMdx, { theme: "vitesse-dark" }],
],
rehypePlugins: [rehypeKatex, rehypeRaw],
format: "mdx",
},
parseFrontmatter: true,
},
});
```

## Peer Dependencies

This package requires shiki as a peer dependency. Ensure that it is installed in your project.

## Supported Themes

Shiki supports a variety of themes. For a full list of available themes, check the Shiki documentation.

0 comments on commit bf1f002

Please sign in to comment.