Skip to content

Commit

Permalink
asciidoctor tab extension (#25)
Browse files Browse the repository at this point in the history
* integrate Asciidoctor Tabs

* add tabs styles

* update asciidoctor-tabs dependency

---------

Co-authored-by: Dan Allen <[email protected]>
  • Loading branch information
josuebran and mojavelinux authored Oct 6, 2023
1 parent b60b172 commit 5948f5d
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 1 deletion.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@fontsource/material-icons-outlined": "~5.0",
"@fontsource/roboto-flex": "~5.0",
"@fontsource/roboto-mono": "~5.0",
"@asciidoctor/tabs": "1.0.0-beta.6",
"autoprefixer": "~9.7",
"browser-pack-flat": "~3.4",
"browserify": "~16.5",
Expand Down
19 changes: 18 additions & 1 deletion preview-src/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,24 @@ Contains more than one block.

=== Example: Overflow tabset

[tabs]
[tabs.overflow]
======
Tab Name:: Contents of Tab.
Longer Tab Name::
+
Contents of Longer Tab.
An Even Longer Tab Name::
+
Contents of Even Longer Tab.
This Is The Longest Tab Name::
+
Contents of The Longest Tab.
======

[tabs.wrapping]
======
Tab Name:: Contents of Tab.
Expand Down
Binary file added preview-src/tux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions preview-src/ui-model.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
antoraVersion: '1.0.0'
asciidoc:
extensions:
- '@asciidoctor/tabs'
site:
url: http://localhost:5252
title: Brand Docs
Expand Down
56 changes: 56 additions & 0 deletions src/css/vendor/tabs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@import "@asciidoctor/tabs";

/* Datastax styles */

.tabpanel {
padding: var(--ds-space-2) 0;
border: none;
border-top: 1px solid var(--ds-divider);
}

.tablist > ul li {
background-color: transparent;
border: none;
font-weight: normal;
color: var(--ds-text-primary);
padding: var(--ds-space-1) var(--ds-space-1h);
}

.tablist.ulist > ul li + li {
margin: 0;
}

.tabs .tablist li::after {
height: calc(2 / var(--rem-base) * 1rem);
}

.tabs.is-loading .tablist li:not(:first-child),
.tabs:not(.is-loading) .tablist li:not(.is-selected) {
color: var(--ds-text-tertiary);
background-color: transparent;
}

.tabs.is-loading .tablist li:first-child::after,
.tabs:not(.is-loading) .tablist li.is-selected::after {
background-color: var(--ds-text-primary);
}

/* overflow tab title */
.tabs.overflow .tablist > ul li p {
max-width: var(--ds-space-15);
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}

/* wrapping tab title */
.tabs.wrapping .tablist > ul li p {
max-width: var(--ds-space-15);
display: flex;
}

.tabs.overflow .tablist > ul,
.tabs.wrapping .tablist > ul {
flex-wrap: nowrap;
}
1 change: 1 addition & 0 deletions src/js/vendor/tabs.bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('@asciidoctor/tabs')
1 change: 1 addition & 0 deletions src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script id="site-script" src="{{{uiRootPath}}}/js/site.js" data-ui-root-path="{{{uiRootPath}}}"></script>
<script async src="{{{uiRootPath}}}/js/vendor/tabs.js"></script>
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
Expand Down
1 change: 1 addition & 0 deletions src/partials/head-styles.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site.css">
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/tabs.css">

0 comments on commit 5948f5d

Please sign in to comment.