@tamagui/code-to-html 1.48.11 → 1.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/code-to-html",
3
- "version": "1.48.11",
3
+ "version": "1.49.1",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -30,7 +30,7 @@
30
30
  "url": "^0.11.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@tamagui/build": "1.48.11"
33
+ "@tamagui/build": "1.49.1"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -42,7 +42,7 @@ const lineNumberify = function lineNumberify(ast, lineNum = 1) {
42
42
  result.nodes.push(node)
43
43
  return result
44
44
  },
45
- { nodes: [], lineNumber: lineNumber },
45
+ { nodes: [], lineNumber: lineNumber }
46
46
  )
47
47
  }
48
48
 
@@ -97,13 +97,11 @@ const applyMultilineFix = function (ast) {
97
97
 
98
98
  // Fix JSX issue
99
99
  html = html.replace(MULTILINE_TOKEN_SPAN, (match, token) =>
100
- match.replace(/\n/g, `</span>\n<span class="token ${token}">`),
100
+ match.replace(/\n/g, `</span>\n<span class="token ${token}">`)
101
101
  )
102
102
 
103
103
  // HTML to AST
104
- const hast = unified()
105
- .use(parse, { emitParseErrors: true, fragment: true })
106
- .parse(html)
104
+ const hast = unified().use(parse, { emitParseErrors: true, fragment: true }).parse(html)
107
105
 
108
106
  return hast.children
109
107
  }
@@ -9,7 +9,7 @@ export function highlightWord(code) {
9
9
  const html = toHtml(code)
10
10
  const result = html.replace(
11
11
  CALLOUT,
12
- (_, text) => `<span class="highlight-word">${text}</span>`,
12
+ (_, text) => `<span class="highlight-word">${text}</span>`
13
13
  )
14
14
  const hast = unified()
15
15
  .use(parse, { emitParseErrors: true, fragment: true })
package/src/index.ts CHANGED
@@ -10,11 +10,7 @@ import { highlightWord } from './highlightWord'
10
10
  refractor.register(tsx)
11
11
  refractor.register(css)
12
12
 
13
- export function codeToHTML(
14
- source: string,
15
- language: 'tsx' | 'css' | string,
16
- line = '0',
17
- ) {
13
+ export function codeToHTML(source: string, language: 'tsx' | 'css' | string, line = '0') {
18
14
  let result: any = refractor.highlight(source, language)
19
15
  result = highlightLine(result, rangeParser(line))
20
16
  result = highlightWord(result)
@@ -1 +1 @@
1
- {"version":3,"file":"highlightLine.d.ts","sourceRoot":"","sources":["../src/highlightLine.ts"],"names":[],"mappings":"AA8GA,wBAAgB,aAAa,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,OAIvC"}
1
+ {"version":3,"file":"highlightLine.d.ts","sourceRoot":"","sources":["../src/highlightLine.ts"],"names":[],"mappings":"AA4GA,wBAAgB,aAAa,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,OAIvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,EAChC,IAAI,SAAM,UAOX"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,EAAE,IAAI,SAAM,UAMtF"}