diff --git a/packages/ui-components/.stylelintrc.mjs b/packages/ui-components/.stylelintrc.mjs
index 1880b1ce2d8ae..a45a17b041527 100644
--- a/packages/ui-components/.stylelintrc.mjs
+++ b/packages/ui-components/.stylelintrc.mjs
@@ -45,5 +45,7 @@ export default {
'import-notation': 'string',
// Allow the `@apply` at rule as its part of Tailwind
'at-rule-no-deprecated': [true, { ignoreAtRules: CUSTOM_AT_RULES }],
+ // We need complex `:not()` for headings with anchor
+ 'selector-not-notation': null,
},
};
diff --git a/packages/ui-components/__design__/text.stories.tsx b/packages/ui-components/__design__/text.stories.tsx
index 9ed6ca21834d8..6b49a6757148a 100644
--- a/packages/ui-components/__design__/text.stories.tsx
+++ b/packages/ui-components/__design__/text.stories.tsx
@@ -27,6 +27,12 @@ export const InlineCode: StoryObj = {
This is an example of inline code block
+
+ This is an example of{' '}
+
+ inline code block inside link
+
+
),
};
@@ -44,4 +50,31 @@ export const Headings: StoryObj = {
),
};
+// Create the behavior of the headings with links
+// on nodejs.org, this is happening due to `rehype-autolink-headings`
+export const HeadingsWithLinks: StoryObj = {
+ render: () => (
+
+
+
+
+
+
+
+
+ ),
+};
+
export default { title: 'Design System' } as MetaObj;
diff --git a/packages/ui-components/styles/markdown.css b/packages/ui-components/styles/markdown.css
index d7296ca88c6f5..f1c91f056fc84 100644
--- a/packages/ui-components/styles/markdown.css
+++ b/packages/ui-components/styles/markdown.css
@@ -75,7 +75,8 @@ main {
dark:text-white;
}
- a,
+ /* link that isn't inside a heading */
+ a:not(h1 > a):not(h2 > a):not(h3 > a):not(h4 > a):not(h5 > a):not(h6 > a),
.anchor {
@apply max-xs:font-semibold
text-green-600
@@ -93,6 +94,10 @@ main {
&:has(code) {
@apply max-xs:decoration-neutral-800
dark:max-xs:decoration-neutral-200;
+
+ code {
+ @apply text-inherit;
+ }
}
}
diff --git a/packages/ui-components/styles/theme.css b/packages/ui-components/styles/theme.css
index 8b6e42ee608ce..8a5e56530a0d7 100644
--- a/packages/ui-components/styles/theme.css
+++ b/packages/ui-components/styles/theme.css
@@ -76,7 +76,6 @@
--color-white: #fff;
--color-transparent: 'transparent';
--color-shadow: #101828;
- --inherit: 'inherit';
--shadow-xs: 0px 1px 2px 0px --alpha(var(--color-shadow, #101828) / 5%);
--shadow-lg:
0px 4px 6px -2px --alpha(var(--color-shadow, #101828) / 3%),
@@ -170,3 +169,7 @@
var(--tw-gradient-to)
);
}
+
+@utility text-inherit {
+ color: inherit;
+}