Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more Rapidoc slots #217

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/css/doc.css
Original file line number Diff line number Diff line change
Expand Up @@ -445,85 +445,85 @@ html {
vertical-align: middle;
}

.doc .admonitionblock {
.admonitionblock {
position: relative;
margin: 1.4rem 0 0;
box-shadow: var(--admonition-border-box-shadow);
padding: var(--admonition-padding);
}

.doc .admonitionblock.note {
.admonitionblock.note {
background-color: var(--note-background);
border-left-width: var(--admonition-border-left-width);
border-radius: var(--admonition-border-radius);
}

.doc .admonitionblock.warning {
.admonitionblock.warning {
background-color: var(--warning-background);
border-left-width: var(--admonition-border-left-width);
border-radius: var(--admonition-border-radius);
}

.doc .admonitionblock.tip {
.admonitionblock.tip {
background-color: var(--tip-background);
border-left-width: var(--admonition-border-left-width);
border-radius: var(--admonition-border-radius);
}

.doc .admonitionblock.caution {
.admonitionblock.caution {
background-color: var(--caution-background);
border-left-width: var(--admonition-border-left-width);
border-radius: var(--admonition-border-radius);
}

.doc .admonitionblock.important {
.admonitionblock.important {
background-color: var(--important-background);
border-left-width: var(--admonition-border-left-width);
border-radius: var(--admonition-border-radius);
}

.doc .admonitionblock td.content > :not(.title):first-child,
.doc .admonitionblock td.content > .title + * {
.admonitionblock td.content > :not(.title):first-child,
.admonitionblock td.content > .title + * {
margin-top: 0;
}

.doc .admonitionblock pre {
.admonitionblock pre {
font-size: calc(17 / var(--rem-base) * 1rem);
}

/* Note - dan - for some bizarre reason tables are used to structure notices, we have to turn all these table elements into block elements to get them to style correctly */
/* I had to change this back to a fixed table layout to avoid the code blocks from escaping the admonition */
.doc .admonitionblock > table {
.admonitionblock > table {
table-layout: fixed;
position: relative;
width: 100%;
}

.doc .admonitionblock td.content {
.admonitionblock td.content {
display: block;
width: 100%;
word-wrap: anywhere;
margin-top: 8px;
padding-left: 1.8rem;
}

.doc .admonitionblock .icon {
.admonitionblock .icon {
display: block;
font-size: calc(18 / var(--rem-base) * 1rem);
height: 1.25rem;
line-height: 1;
font-weight: var(--admonition-label-font-weight);
}

.doc .admonitionblock.caution .icon {
.admonitionblock.caution .icon {
color: var(--caution-on-color);
}

.doc .admonitionblock.important .icon {
.admonitionblock.important .icon {
color: var(--important-on-color);
}

.doc .admonitionblock.note .icon {
.admonitionblock.note .icon {
color: var(--note-on-color);
}

Expand Down Expand Up @@ -567,14 +567,14 @@ html {
height: 1.4em;
}

.doc .admonitionblock .icon i {
.admonitionblock .icon i {
display: inline-flex;
align-items: center;
height: 100%;
font: unset;
}

.doc .admonitionblock .icon i::after {
.admonitionblock .icon i::after {
content: attr(title);
}

Expand Down Expand Up @@ -797,11 +797,11 @@ table code {

.doc .ulist .listingblock,
.doc .olist .listingblock,
.doc .admonitionblock .listingblock {
.admonitionblock .listingblock {
padding: 0;
}

.doc .admonitionblock .title {
.admonitionblock .title {
font-weight: bold;
}

Expand Down Expand Up @@ -831,7 +831,7 @@ table code {
}

/* immediate sibling of an element with the class title, where this title class element is a direct child of a td element with the class content */
.doc .admonitionblock td.content > .title + * {
.admonitionblock td.content > .title + * {
margin-top: 20px;
}

Expand Down
7 changes: 4 additions & 3 deletions src/helpers/get-api-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ module.exports = (url, { data }) => {
}

function wrapHtmlWithSlot (htmlContent, slotName) {
// Check if the slotName is 'auth' or 'overview'
if (slotName === 'auth' || slotName === 'overview') {
return `<div slot="${slotName}">${htmlContent}</div>`
if (slotName) {
// Replace all instances of '9' with '/'
const modifiedSlotName = slotName.replace(/9/g, '/')
return `<div slot="${modifiedSlotName}">${htmlContent}</div>`
}
// Return the content without wrapping if the slot does not match
return htmlContent
Expand Down
2 changes: 2 additions & 0 deletions src/partials/breadcrumbs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
{{#with site.homeUrl}}
<li><a href="{{{relativize this}}}" aria-label="Go to home page">Docs</a></li>
{{/with}}
{{#if (ne page.component.name 'api')}}
<li>
<a href="{{{relativize page.component.url}}}">{{{page.component.title}}}</a>
</li>
{{/if}}
{{#if page.breadcrumbs}}
{{#each page.breadcrumbs}}
{{#if (ne (relativize ./url) (relativize @root.page.component.url))}}
Expand Down
Loading