Skip to content

Commit

Permalink
feat: v3
Browse files Browse the repository at this point in the history
  • Loading branch information
naiyerasif committed Apr 16, 2024
1 parent a0106c7 commit 26fd647
Show file tree
Hide file tree
Showing 11 changed files with 732 additions and 588 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,29 @@ on:
push:
branches:
- main
- v3

jobs:
regression:
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 8

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: npm install
run: pnpm install --frozen-lockfile

- name: Run the tests
run: npm test
run: pnpm test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*temp
.workspace
node_modules
.DS_Store
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.github
*temp
test
.workspace
test
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

A metadata parser for code fences in markdown

## Contents

- [Contents](#contents)
- [What’s this?](#whats-this)
- [Install](#install)
- [Use](#use)
Expand Down Expand Up @@ -42,14 +39,14 @@ npm install @microflash/fenceparser
In Deno, with [esm.sh](https://esm.sh/):

```js
import fenceparser from 'https://esm.sh/@microflash/fenceparser'
import fenceparser from "https://esm.sh/@microflash/fenceparser";
```

In browsers, with [esm.sh](https://esm.sh/):

```html
<script type="module">
import fenceparser from 'https://esm.sh/@microflash/fenceparser?bundle'
import fenceparser from "https://esm.sh/@microflash/fenceparser?bundle";
</script>
```

Expand All @@ -73,9 +70,9 @@ Say, you have the following code fence
Use the `fenceparser` to parse the `meta` as follows.

```js
import parse from '@microflash/fenceparser'
import parse from "@microflash/fenceparser";

console.log(parse("{1} {3, 7} {9-11, 88} ins{90, 101..112} text-color='--text-default' syntax_theme=\"nord\" css=`{ *: { display: none }}`"))
console.log(parse("{1} {3, 7} {9-11, 88} ins{90, 101..112} text-color='--text-default' syntax_theme=\"nord\" css=`{ *: { display: none }}`"));
```

Running the above example yields.
Expand Down Expand Up @@ -121,9 +118,9 @@ The default export is `parse`.
### Example: single range

```js
import parse from '@microflash/fenceparser'
import parse from "@microflash/fenceparser";

console.log(parse("{100}"))
console.log(parse("{100}"));
```

Running the above example yields.
Expand All @@ -139,9 +136,9 @@ Running the above example yields.
### Example: multiple ranges

```js
import parse from '@microflash/fenceparser'
import parse from "@microflash/fenceparser";

console.log(parse("{3, 7} {9-11, 101..105}"))
console.log(parse("{3, 7} {9-11, 101..105}"));
```

Running the above example yields.
Expand All @@ -159,9 +156,9 @@ Running the above example yields.


```js
import parse from '@microflash/fenceparser'
import parse from "@microflash/fenceparser";

console.log(parse("{3, 7} ins{9-11, 13} del{101..105}"))
console.log(parse("{3, 7} ins{9-11, 13} del{101..105}"));
```

Running the above example yields.
Expand All @@ -183,9 +180,9 @@ Running the above example yields.
### Example: key-value pairs

```js
import parse from '@microflash/fenceparser'
import parse from "@microflash/fenceparser";

console.log(parse("data-theme='synthwave' callback=`(code) => copyToClipboard(code)`"))
console.log(parse("data-theme='synthwave' callback=`(code) => copyToClipboard(code)`"));
```

Running the above example yields.
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microflash/fenceparser",
"version": "2.6.2",
"version": "3.0.0-beta.1",
"description": "A metadata parser for code fences in markdown",
"main": "src/index.js",
"scripts": {
Expand All @@ -16,16 +16,18 @@
"parser",
"lexer"
],
"author": "Naiyer Asif (https://mflash.dev)",
"author": "Naiyer Asif (https://www.naiyerasif.com)",
"license": "MIT",
"bugs": "https://github.com/Microflash/fenceparser/issues",
"homepage": "https://github.com/Microflash/fenceparser#readme",
"dependencies": {
"chevrotain": "^10.4.2"
"chevrotain": "^11.0.3",
"defu": "^6.1.4"
},
"devDependencies": {
"ava": "^5.1.0"
"ava": "^6.1.2"
},
"packageManager": "[email protected]",
"ava": {
"files": [
"test/**/*.test.js"
Expand Down
Loading

0 comments on commit 26fd647

Please sign in to comment.