-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
360 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
<script lang="ts"> | ||
import './prism.scss'; | ||
//import './prism.scss'; | ||
import './hljs.scss'; | ||
type InputLanguage = 'html' | 'ts' | 'css' | 'svelte' | 'jsx'; | ||
type InputLanguage = | ||
'html' | | ||
'css' | | ||
'js' | | ||
'ts' | | ||
'svelte' | | ||
'jsx'; | ||
export let code: string; | ||
export let language: InputLanguage = 'html'; | ||
const languagesMap : Partial<Record<InputLanguage, Language>> = { | ||
svelte: 'tsx', | ||
svelte: 'html', | ||
jsx: 'js' | ||
} | ||
const languageCode = (languagesMap[language] || language) as Language; | ||
import getCode, { type Language } from './prism.js'; | ||
import getCode, { type Language } from './getCode.js'; | ||
</script> | ||
|
||
<pre class="language-{languageCode}"><code>{@html getCode(code, languageCode)}</code></pre> | ||
<pre class="language-{languageCode} hljs"><code>{@html getCode(code, languageCode)}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.