Skip to content

Commit

Permalink
Fix link appearance in code (#260)
Browse files Browse the repository at this point in the history
* Fix link appearance in code

* Revert testing/index.md

* Move to custom.css
  • Loading branch information
reakaleek authored Jan 17, 2025
1 parent 1d36c3d commit dd08e82
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/Elastic.Markdown/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,57 @@ section:has(+ .product-availability) h2 {
font-weight: bold;
text-align: left;
padding-left: 0;
}

/*
The following CSS is used to hack the cases where a 'code' tag is combined
with an 'a' tag that contains a 'code' tag as a child to make it appear as if it
was a single entity.
See https://github.com/elastic/docs-builder/issues/219 for further details
*/

/* select every 'a' tag with 'code' as child */
.yue a:has(> code:only-child) {
border: 0 !important;
text-decoration: underline;
color: var(--yue-c-code-text);
}

/* select 'code' tag with 'a' tag as parent */
.yue a > code:only-child {
color: var(--yue-c-code-text);
font-size: 0.875em;
padding: 2px 4px;
border-radius: 3px;
font-weight: 500;
background-color: var(--yue-c-code-background);
}

/* select 'code' tag with 'a' tag as parent if the next sibling is 'code' */
.yue a:has(> code:only-child):has(+ code) > code:only-child {
padding-right: 0;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}

/* select 'code' tag with 'a' tag parent if previous sibling tag is 'code */
.yue code + a > code:only-child {
padding-left: 0;
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}

/* select 'code' tag if previous sibling is 'a' tag with 'code' tag child */
.yue a:has(> code:only-child) + code {
padding-left: 0;
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}

/* select 'code' tag if next sibling is 'a' tag with 'code' tag child */
.yue code:has(+ a > code:only-child) {
padding-right: 0 !important;
border-bottom-right-radius: 0 !important;
border-top-right-radius: 0 !important;
}

0 comments on commit dd08e82

Please sign in to comment.