Skip to content

Commit dd08e82

Browse files
authored
Fix link appearance in code (#260)
* Fix link appearance in code * Revert testing/index.md * Move to custom.css
1 parent 1d36c3d commit dd08e82

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/Elastic.Markdown/_static/custom.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,57 @@ section:has(+ .product-availability) h2 {
7272
font-weight: bold;
7373
text-align: left;
7474
padding-left: 0;
75+
}
76+
77+
/*
78+
The following CSS is used to hack the cases where a 'code' tag is combined
79+
with an 'a' tag that contains a 'code' tag as a child to make it appear as if it
80+
was a single entity.
81+
82+
See https://github.com/elastic/docs-builder/issues/219 for further details
83+
*/
84+
85+
/* select every 'a' tag with 'code' as child */
86+
.yue a:has(> code:only-child) {
87+
border: 0 !important;
88+
text-decoration: underline;
89+
color: var(--yue-c-code-text);
90+
}
91+
92+
/* select 'code' tag with 'a' tag as parent */
93+
.yue a > code:only-child {
94+
color: var(--yue-c-code-text);
95+
font-size: 0.875em;
96+
padding: 2px 4px;
97+
border-radius: 3px;
98+
font-weight: 500;
99+
background-color: var(--yue-c-code-background);
100+
}
101+
102+
/* select 'code' tag with 'a' tag as parent if the next sibling is 'code' */
103+
.yue a:has(> code:only-child):has(+ code) > code:only-child {
104+
padding-right: 0;
105+
border-bottom-right-radius: 0;
106+
border-top-right-radius: 0;
107+
}
108+
109+
/* select 'code' tag with 'a' tag parent if previous sibling tag is 'code */
110+
.yue code + a > code:only-child {
111+
padding-left: 0;
112+
border-bottom-left-radius: 0;
113+
border-top-left-radius: 0;
114+
}
115+
116+
/* select 'code' tag if previous sibling is 'a' tag with 'code' tag child */
117+
.yue a:has(> code:only-child) + code {
118+
padding-left: 0;
119+
border-bottom-left-radius: 0;
120+
border-top-left-radius: 0;
121+
}
122+
123+
/* select 'code' tag if next sibling is 'a' tag with 'code' tag child */
124+
.yue code:has(+ a > code:only-child) {
125+
padding-right: 0 !important;
126+
border-bottom-right-radius: 0 !important;
127+
border-top-right-radius: 0 !important;
75128
}

0 commit comments

Comments
 (0)