Skip to content

Commit

Permalink
Removes inline scripts and inline styles in botocore documentation si…
Browse files Browse the repository at this point in the history
…te to make it compatible with the newly added security headers (#3336)

* This change removes the use of inline scripts and styles in the Botocore documentation site to make it compatible with the newly implemented security headers.
  • Loading branch information
ubaskota authored Jan 23, 2025
1 parent 60a2fc6 commit 63051c4
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 114 deletions.
49 changes: 28 additions & 21 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
/* Prevents two-dimensional scrolling and content loss. */
h1, code, li {
h1,
code,
li {
overflow-wrap: break-word;
}
/* Provides padding to push down the "breadcrumb" navigation in nested pages. */
.content{
.content {
padding: 1em 3em;
}
/* Improves spacing around custom sidebar section*/
.sidebar-div{
.sidebar-div {
margin: var(--sidebar-caption-space-above) 0 0 0;
padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);
padding: var(--sidebar-item-spacing-vertical)
var(--sidebar-item-spacing-horizontal);
}
/* Custom sidebar heading text. Example: Feedback Section heading. */
.sidebar-heading{
.sidebar-heading {
color: var(--color-sidebar-caption-text);
font-size: var(--font-size--normal);
font-weight: 700;
}
/* Improves text used in custom sidebar section. Example: Feedback section content.*/
.sidebar-text{
.sidebar-text {
color: var(--color-sidebar-caption-text);
font-size: var(--sidebar-item-font-size);
line-height: 1.4;
}
/* Removes empty space above the sidebar-tree (under "Feedback" section) */
.sidebar-tree{
.sidebar-tree {
margin-top: 0px;
}
/* Adds padding around AWS Logo in the left sidebar. */
.sidebar-logo{
.sidebar-logo {
padding: 20% 15%;
}
/* Hides a div by default. */
Expand All @@ -52,7 +55,7 @@ h1, code, li {
visibility: hidden;
}
/* Hides the icon by default and applies relevant styling. */
.nav-close-icon{
.nav-close-icon {
color: var(--color-foreground-secondary);
display: flex;
align-items: center;
Expand All @@ -73,24 +76,24 @@ h1, code, li {
}
}
@media (max-width: 82em) {
/* Displays a div on a medium screen. */
/* Displays a div on a medium screen. */
.show-div-md {
display: flex;
}
}
/* Apply furo styled admonition titles for <h3>. */
h3.admonition-title {
position: relative;
margin: 0 -0.5rem 0.5rem;
padding-left: 2.5rem;
padding-right: .5rem;
padding-top: .4rem;
padding-bottom: .4rem;
font-weight: 700;
font-size: 1.5em;
line-height: 1.25;
border-radius: unset;
background-color: var(--color-admonition-title-background);
position: relative;
margin: 0 -0.5rem 0.5rem;
padding-left: 2.5rem;
padding-right: 0.5rem;
padding-top: 0.4rem;
padding-bottom: 0.4rem;
font-weight: 700;
font-size: 1.5em;
line-height: 1.25;
border-radius: unset;
background-color: var(--color-admonition-title-background);
}
/* Apply furo styled admonition icons before <h3>. */
h3.admonition-title::before {
Expand All @@ -103,3 +106,7 @@ h3.admonition-title::before {
mask-image: var(--icon-admonition-default);
mask-repeat: no-repeat;
}
/* Hides an element by removing it from the document flow */
.hidden {
display: none;
}
23 changes: 23 additions & 0 deletions docs/source/_static/css/dark_light_mode.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*This file replaces the style defined in the "_head_css_variables.html"
partial from furo==2022.12.7*/

body {
--color-code-background: #f8f8f8;
--color-code-foreground: black;
}

/* Dark theme styles */
@media not print {
body[data-theme="dark"] {
--color-code-background: #272822;
--color-code-foreground: #f8f8f2;
}

/* For users who prefer dark color scheme */
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
--color-code-background: #272822;
--color-code-foreground: #f8f8f2;
}
}
}
Loading

0 comments on commit 63051c4

Please sign in to comment.