Skip to content

Commit 18e4d9b

Browse files
committed
docs: update theme
1 parent 1daf7cf commit 18e4d9b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/docs/gatsby-node.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path')
1+
const path = require('node:path')
22
const { createFilePath } = require('gatsby-source-filesystem')
33

44
exports.onCreateNode = async ({ node, loadNodeContent, actions: { createNodeField }, getNode }) => {
@@ -14,7 +14,11 @@ exports.onCreateNode = async ({ node, loadNodeContent, actions: { createNodeFiel
1414

1515
if (node.ext === '.scss') {
1616
const nodeContent = await loadNodeContent(node)
17-
createNodeField({ node, name: `content`, value: nodeContent })
17+
createNodeField({
18+
node,
19+
name: `content`,
20+
value: nodeContent,
21+
})
1822
}
1923
}
2024

packages/docs/src/components/ScssDocs.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { FC } from 'react'
22
import { useStaticQuery, graphql } from 'gatsby'
33
import { Highlight, Prism } from 'prism-react-renderer'
44

5-
const ScssDocs: FC = ({ file, capture }: { file?: string; capture?: string }) => {
5+
const ScssDocs: FC = ({ file, capture }: { file: string; capture: string }) => {
66
;(typeof global === 'undefined' ? window : global).Prism = Prism
77
// eslint-disable-next-line unicorn/prefer-module
88
require('prismjs/components/prism-scss')
@@ -28,9 +28,8 @@ const ScssDocs: FC = ({ file, capture }: { file?: string; capture?: string }) =>
2828
const captureStart = `// scss-docs-start ${capture}`
2929
const captureEnd = `// scss-docs-end ${capture}`
3030
const re = new RegExp(`${captureStart}((?:.|\n)*)${captureEnd}`)
31-
const code = re.test(_file.node.internal.content)
32-
? re.exec(_file.node.internal.content)[1].trim()
33-
: null
31+
const captured = re.exec(_file.node.internal.content)
32+
const code = captured && captured[1].trim()
3433

3534
return (
3635
code && (

0 commit comments

Comments
 (0)