Skip to content

Commit 6302d8e

Browse files
committed
fix(docs-infra): support header values containing apostrophes
Update the `headerRule` regex to capture the complete quoted header value. The previous pattern excluded quote characters from the content and failed to parse headers such as: ```angular-ts {avoid, header: "Can't inject interface"} ``` The new pattern matches everything between the opening and closing quote delimiters.
1 parent e6ae250 commit 6302d8e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

adev/shared-docs/pipeline/shared/marked/extensions/docs-code/docs-code-block.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const docsCodeBlockExtension = {
3838
if (match) {
3939
const metadataStr = match[2].trim();
4040

41-
const headerRule = /header\s*:\s*(['"`])([^'"`]+)\1/; // The 2nd capture matters here
41+
const headerRule = /header\s*:\s*(['"`])(.*?)\1/; // The 2nd capture matters here
4242
const highlightRule = /highlight\s*:\s*(.*)([^,])/;
4343
const hideCopyRule = /hideCopy/;
4444
const hideDollarRule = /hideDollar/;

adev/src/content/guide/di/debugging-and-troubleshooting-di.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ TIP: Always export tokens from a shared file and import them everywhere they're
440440

441441
When you define a TypeScript interface, it only exists during compilation for type checking. TypeScript erases all interface definitions when it compiles to JavaScript, so at runtime there's no object for Angular to use as an injection token. If you try to inject an interface type, Angular has nothing to match against the provider configuration.
442442

443-
```angular-ts {avoid, header: 'Can't inject interface'}
443+
```angular-ts {avoid, header: "Can't inject interface"}
444444
interface UserConfig {
445445
name: string;
446446
email: string;

0 commit comments

Comments
 (0)