-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Light/dark theming for shikiji's codeblocks (#8903)
Co-authored-by: Sarah Rainsberger <[email protected]>
- Loading branch information
1 parent
1ecc9aa
commit c5010aa
Showing
8 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@astrojs/markdown-remark': minor | ||
'astro': minor | ||
--- | ||
|
||
Adds experimental support for multiple shiki themes with the new `markdown.shikiConfig.experimentalThemes` option. |
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
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
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
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,12 +1,30 @@ | ||
import { createMarkdownProcessor } from '../dist/index.js'; | ||
import chai from 'chai'; | ||
|
||
describe('shiki syntax highlighting', async () => { | ||
const processor = await createMarkdownProcessor(); | ||
|
||
describe('shiki syntax highlighting', () => { | ||
it('does not add is:raw to the output', async () => { | ||
const processor = await createMarkdownProcessor(); | ||
const { code } = await processor.render('```\ntest\n```'); | ||
|
||
chai.expect(code).not.to.contain('is:raw'); | ||
}); | ||
|
||
it('supports light/dark themes', async () => { | ||
const processor = await createMarkdownProcessor({ | ||
shikiConfig: { | ||
experimentalThemes: { | ||
light: 'github-light', | ||
dark: 'github-dark', | ||
}, | ||
}, | ||
}); | ||
const { code } = await processor.render('```\ntest\n```'); | ||
|
||
// light theme is there: | ||
chai.expect(code).to.contain('background-color:'); | ||
chai.expect(code).to.contain('github-light'); | ||
// dark theme is there: | ||
chai.expect(code).to.contain('--shiki-dark-bg:'); | ||
chai.expect(code).to.contain('github-dark'); | ||
}); | ||
}); |