Skip to content

Commit

Permalink
Make regex non-greedy
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
  • Loading branch information
giuseppelt and bluwy authored Jan 11, 2023
1 parent 07eee72 commit 69b872c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/astro/components/Code.astro
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const { code, lang = 'plaintext', theme = 'github-dark', wrap = false } = Astro.
/** Replace the shiki class name with a custom astro class name. */
function repairShikiTheme(html: string): string {
// Replace "shiki" class naming with "astro"
html = html.replace(/<pre class="(.*)shiki(.*)"/, '<pre class="$1astro-code$2"');
html = html.replace(/<pre class="(.*?)shiki(.*?)"/, '<pre class="$1astro-code$2"');
// Handle code wrapping
// if wrap=null, do nothing.
if (wrap === false) {
Expand Down

0 comments on commit 69b872c

Please sign in to comment.