Skip to content

Commit

Permalink
pass workingDirectory to Code component examples
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed Dec 30, 2023
1 parent 2dd1b1e commit e4a68eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-tables-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mdxts": minor
---

Pass `workingDirectory` to Code component used in examples.
2 changes: 1 addition & 1 deletion mdxts/src/components/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function Code({
if ('source' in props) {
if (!props.workingDirectory) {
throw new Error(
'The [workingDirectory] prop was not provided to the [Code] component. Make sure the mdxts/remark plugin is configured correctly.'
'The [workingDirectory] prop was not provided to the [Code] component. Make sure the mdxts/remark plugin and mdxts/loader are configured correctly.'
)
}

Expand Down
2 changes: 1 addition & 1 deletion mdxts/src/loader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default async function loader(
source =
`import theme from '${relativeThemePath}';\n${source}`.replaceAll(
'<Code',
'<Code theme={theme}'
`<Code theme={theme} workingDirectory="${workingDirectory}"`
)
} else {
source = `import { setTheme } from 'mdxts';\nimport theme from '${relativeThemePath}';\nsetTheme(theme);\n${source}`
Expand Down

1 comment on commit e4a68eb

@vercel
Copy link

@vercel vercel bot commented on e4a68eb Dec 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.