Skip to content

Commit

Permalink
allow omitting extension
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed Apr 29, 2024
1 parent e4eac5a commit f21cf8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-parrots-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mdxts": patch
---

Allows omitting `CodeBlock` filename extension and uses `language` if provided.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export async function parseSourceTextMetadata({
filename = join('mdxts', filename)
}

// Add extension if filename prop is missing it.
if (filenameProp && !filename.includes('.')) {
filename = `${filename}.${finalLanguage}`
}

// Create a ts-morph source file to type-check JavaScript and TypeScript code blocks.
if (isJavaScriptLikeLanguage) {
try {
Expand Down

0 comments on commit f21cf8d

Please sign in to comment.