Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add regex to match ContentSlot in Pug templates #2344

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ export interface ModuleOptions {
* @default {}
*/
anchorLinks?: boolean | {
/**
* Sets the maximal depth for anchor link generation
*
* @default 4
*/
/**
* Sets the maximal depth for anchor link generation
*
* @default 4
*/
depth?: number,
/**
* Excludes headings from link generation when they are in the depth range.
Expand Down Expand Up @@ -339,6 +339,7 @@ export default defineNuxtModule<ModuleOptions>({
code = code.replace(/<\/ContentSlot>/g, '</MDCSlot>')
code = code.replace(/<ContentSlot/g, '<MDCSlot')
code = code.replace(/(['"])ContentSlot['"]/g, '$1MDCSlot$1')
code = code.replace(/ContentSlot\(([^(]*)(:use=['"](\$slots.)?([a-zA-Z0-9_-]*)['"]|use=['"]([a-zA-Z0-9_-]*)['"])([^)]*)/g, 'MDCSlot($1name="$4"$6')
return {
code,
map: { mappings: '' }
Expand Down