Skip to content

Commit

Permalink
fix: support sugar-high v9 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue authored Feb 6, 2025
1 parent 28b7366 commit 69c8e86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"prosemirror-view": "^1.32.4",
"refractor": "^4.8.1",
"shiki": "^1.9.0 || ^2.0.0",
"sugar-high": "^0.6.1 || ^0.7.0 || ^0.8.0"
"sugar-high": "^0.6.1 || ^0.7.0 || ^0.8.0 || ^0.9.0"
},
"peerDependenciesMeta": {
"@types/hast": {
Expand Down Expand Up @@ -119,7 +119,7 @@
"prosemirror-view": "^1.37.2",
"refractor": "^4.8.1",
"shiki": "^2.1.0",
"sugar-high": "^0.8.2",
"sugar-high": "^0.9.2",
"tsup": "^8.3.5",
"typescript": "^5.7.2",
"vite": "^6.0.11",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 2 additions & 17 deletions src/sugar-high.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
import { Decoration } from 'prosemirror-view'
import { tokenize } from 'sugar-high'
import { tokenize, SugarHigh } from 'sugar-high'

import type { Parser } from './types'

export type { Parser }

/**
* Copied from https://github.com/huozhi/sugar-high/blob/v0.6.1/lib/index.js#L80-L107
*/
const types = [
'identifier',
'keyword',
'string',
'class',
'property',
'entity',
'jsxliterals',
'sign',
'comment',
'break',
'space',
] as const
const types = SugarHigh.TokenTypes

export function createParser(): Parser {
return function parser({ content, pos }) {
Expand Down

0 comments on commit 69c8e86

Please sign in to comment.