Skip to content

Commit

Permalink
Update the doscy theme (googleforgames#2123)
Browse files Browse the repository at this point in the history
* Update docsy to f82dd5efa0eb5a03086498686f9e60f7bd2bb5f3.

* Update docsy dependency bootstrap to https://github.com/twbs/bootstrap/tree/6ffb0b48e455430f8a5359ed689ad64c1143fac2

* Update docsy vendor dependency Font-Awesome to https://github.com/FortAwesome/Font-Awesome/tree/fcec2d1b01ff069ac10500ac42e4478d20d21f4c

* Rename master -> main for our default github branch.

* Re-enable rounded buttons and search boxes.

* Fix the color for the left tree nav header so that it isn't the same
as the background color.
  • Loading branch information
roberthbailey authored Jun 15, 2021
1 parent addfaf4 commit 16196ec
Show file tree
Hide file tree
Showing 4,230 changed files with 89,828 additions and 40,513 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 2 additions & 3 deletions site/assets/scss/_variables_project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
Add styles or override variables from the theme here.
*/
$enable-rounded: false;
// $enable-shadows: false;

$display1-weight: 500 !default;
$display2-weight: 100 !default;
Expand All @@ -16,6 +14,7 @@ $secondary: #2D70DE !default;
$light: rgb(255, 255,255) !default;
$grey: #888 !default;
$orange: $secondary;
$td-sidebar-tree-root-color: #222 !default;

.nav-shadow {
box-shadow: 0 2px 2px -2px rgba(0,0,0,.2);
Expand Down Expand Up @@ -64,4 +63,4 @@ input[type="search"]::placeholder {

.showcase img {
margin: 0 30px;
}
}
3 changes: 3 additions & 0 deletions site/themes/docsy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ resources/
node_modules/
tech-doc-hugo

# vim temporary files
*~
*.sw?
19 changes: 14 additions & 5 deletions site/themes/docsy/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Docsy
# Docsy

Docsy is a [Hugo](https://gohugo.io/) theme for technical documentation sets, providing simple navigation, site structure, and more.

Expand All @@ -22,12 +22,12 @@ The following are basic prerequisites for using Docsy in your site:

## Example and usage

You can find an example project that uses Docsy in the [Docsy Example Project repo](https://github.com/google/docsy-example). The Docsy Example Project is hosted at [https://example.docsy.dev/](https://example.docsy.dev/).
You can find an example project that uses Docsy in the [Docsy Example Project repo](https://github.com/google/docsy-example).The Docsy Example Project is hosted at [https://example.docsy.dev/](https://example.docsy.dev/). For real-life examples of sites that use Docsy (and their source repos), see our [Examples](https://www.docsy.dev/docs/examples/) page.

To use the Docsy theme for your own site:

- (Recommended) Copy the [example project](https://github.com/google/docsy-example),
which includes the Docsy theme as a submodule.
- (Recommended) Use the [example project](https://github.com/google/docsy-example),
which includes the Docsy theme as a submodule, as a template to create your project.
You can customize this pre-configured basic site into your own Docsy themed site.
[Learn more...](https://github.com/google/docsy-example)

Expand All @@ -47,4 +47,13 @@ cd docsy/userguide/
hugo server --themesDir ../..
```

Note that you need the `themesDir` flag when running Hugo because the site files are inside the theme repo.
Note: you need the `themesDir` flag when running Hugo because the site files are inside the theme repo.

## Contributing ![GitHub](https://img.shields.io/github/contributors/google/docsy)

Please read [CONTRIBUTING.md](https://github.com/google/docsy/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
See also the list of [contributors](https://github.com/google/docsy/graphs/contributors) who participated in this project.

## License ![GitHub](https://img.shields.io/github/license/google/docsy)

This project is licensed under the Apache License 2.0 - see the [LICENSE.md](https://github.com/google/docsy/blob/master/LICENSE) file for details
38 changes: 38 additions & 0 deletions site/themes/docsy/assets/js/mermaid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{ with .Site.Params.mermaid }}
{{ if .enable }}
(function($) {
var needMermaid = false;
$('.language-mermaid').parent().replaceWith(function() {
needMermaid = true;
return $('<pre class="mermaid">').text($(this).text());
});

if (!needMermaid) {
mermaid.initialize({startOnLoad: false});
return;
}

var params = {{ . | jsonify | safeJS }};

// site params are stored with lowercase keys; lookup correct casing
// from Mermaid default config.
var norm = function(defaultConfig, params) {
var result = {};
for (const key in defaultConfig) {
const keyLower = key.toLowerCase();
if (defaultConfig.hasOwnProperty(key) && params.hasOwnProperty(keyLower)) {
if (typeof defaultConfig[key] === "object") {
result[key] = norm(defaultConfig[key], params[keyLower]);
} else {
result[key] = params[keyLower];
}
}
}
return result;
};
var settings = norm(mermaid.mermaidAPI.defaultConfig, params);
settings.startOnLoad = true;
mermaid.initialize(settings);
})(jQuery);
{{ end }}
{{ end }}
17 changes: 15 additions & 2 deletions site/themes/docsy/assets/js/offline-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@
(data) => {
idx = lunr(function () {
this.ref('ref');
this.field('title', { boost: 2 });

// If you added more searchable fields to the search index, list them here.
// Here you can specify searchable fields to the search index - e.g. individual toxonomies for you project
// With "boost" you can add weighting for specific (default weighting without boost: 1)
this.field('title', { boost: 5 });
this.field('categories', { boost: 3 });
this.field('tags', { boost: 3 });
// this.field('projects', { boost: 3 }); // example for an individual toxonomy called projects
this.field('description', { boost: 2 });
this.field('body');

data.forEach((doc) => {
Expand Down Expand Up @@ -100,7 +108,7 @@
})
.slice(
0,
$targetSearchInput.data('offlnie-search-max-results')
$targetSearchInput.data('offline-search-max-results')
);

//
Expand Down Expand Up @@ -180,8 +188,13 @@
});
});

// Enable inline styles in popover.
const whiteList = $.fn.tooltip.Constructor.Default.whiteList;
whiteList['*'].push('style');

$targetSearchInput
.data('content', $html[0].outerHTML)
.popover({ whiteList: whiteList })
.popover('show');
};
});
Expand Down
62 changes: 62 additions & 0 deletions site/themes/docsy/assets/js/plantuml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{ with .Site.Params.plantuml }}
{{ if .enable }}
(function($) {

function encode64(data) {
r = "";
for (i = 0; i < data.length; i += 3) {
if (i + 2 == data.length) {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0);
} else if (i + 1 == data.length) {
r += append3bytes(data.charCodeAt(i), 0, 0);
} else {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1),
data.charCodeAt(i + 2));
}
}
return r;
}

function append3bytes(b1, b2, b3) {
c1 = b1 >> 2;
c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
c3 = ((b2 & 0xF) << 2) | (b3 >> 6);
c4 = b3 & 0x3F;
r = "";
r += encode6bit(c1 & 0x3F);
r += encode6bit(c2 & 0x3F);
r += encode6bit(c3 & 0x3F);
r += encode6bit(c4 & 0x3F);
return r;
}

function encode6bit(b) {
if (b < 10) {
return String.fromCharCode(48 + b);
}
b -= 10;
if (b < 26) {
return String.fromCharCode(65 + b);
}
b -= 26;
if (b < 26) {
return String.fromCharCode(97 + b);
}
b -= 26;
if (b == 0) {
return '-';
}
if (b == 1) {
return '_';
}
return '?';
}

var needPlantuml = false;
$('.language-plantuml').parent().replaceWith(function() {
let s = unescape(encodeURIComponent($(this).text()));
return $('<img src="{{.svg_image_url | default "http://www.plantuml.com/plantuml/svg/"}}' + encode64(deflate(s, 9)) + '">')
});
})(jQuery);
{{ end }}
{{ end }}
12 changes: 6 additions & 6 deletions site/themes/docsy/assets/scss/_boxes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@include link-variant("#{$parent}--#{$color-name} p > a", $link-color, $link-hover-color, false);

@if $enable-gradients {
@include bg-gradient-variant("#{$parent}--1#{$color-name}#{$parent}--gradient", $color-value);
@include bg-gradient-variant("#{$parent}--1#{$color-name}#{$parent}--gradient", $color-value,true);
}
}

Expand Down Expand Up @@ -80,8 +80,8 @@
// Styling for section boxes
.td-box {
.row.section {
padding-left: 5rem;
padding-right: 5rem;
padding-left: 5vw;
padding-right: 5vw;
flex-direction: column;

> table {
Expand All @@ -94,15 +94,15 @@
}

.row {
padding-left: 5rem;
padding-right: 5rem;
padding-left: 5vw;
padding-right: 5vw;
flex-direction: row;
}
}
// Styling for community page link boxes

.td-box.linkbox {
padding: 5rem;
padding: 5vh 5vw;
}

// This allows "painting by numbers"
Expand Down
19 changes: 10 additions & 9 deletions site/themes/docsy/assets/scss/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
// Highlighted code.
.highlight {
@extend .card;
margin: 2rem 0;
padding: 1rem;
background-color: $gray-100;

pre, div {
background-color: inherit !important;
}

padding: 0;

pre {
margin: 0;
padding: 0;
padding: 1rem;
}
}

Expand Down Expand Up @@ -43,6 +38,7 @@


> code {
background-color: inherit !important;
padding: 0;
margin: 0;
font-size: 100%;
Expand All @@ -51,4 +47,9 @@
border: 0;
}
}

pre.mermaid {
background-color: inherit;
font-size: 0;
}
}
2 changes: 1 addition & 1 deletion site/themes/docsy/assets/scss/_main-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// The outer page container for the default base template.
.td-default {
main {
section:first-of-type {
> section:first-of-type {
@include media-breakpoint-up(md) {
padding-top: 8rem;
}
Expand Down
33 changes: 33 additions & 0 deletions site/themes/docsy/assets/scss/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,37 @@
}
}
}
}

// Icons
#main_navbar {
li i {
padding-right: 0.5em;

&:before {
display: inline-block;
text-align: center;
min-width: 1em;
}
}
.alert {
background-color: inherit;
padding:0;
color: $secondary;
border: 0;
font-weight: inherit;

&:before {
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f0d9";
padding-left: 0.5em;
padding-right: 0.5em;
}
}
}
1 change: 1 addition & 0 deletions site/themes/docsy/assets/scss/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.td-search-input {
background: transparent;
max-width: 90%;

&.form-control:focus {
border-color: lighten($primary, 60%);
Expand Down
31 changes: 28 additions & 3 deletions site/themes/docsy/assets/scss/_sidebar-tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
}

@include media-breakpoint-up(md) {
& > ul {
padding-left: .5rem;
& .ul-1 ul {
padding-left: 1.5em;
}
}

Expand Down Expand Up @@ -87,6 +87,22 @@
padding-top: .5rem;
padding-left: 1.5rem;
}

li i { // Layout of icons
padding-right: 0.5em;
&:before{
display: inline-block;
text-align: center;
min-width: 1em;
}
}

.td-sidebar-link.tree-root{
font-weight: $font-weight-bold;
color: $td-sidebar-tree-root-color;
border-bottom: 1px $td-sidebar-tree-root-color solid;
margin-bottom: 1rem;
}
}

.td-sidebar {
Expand Down Expand Up @@ -134,4 +150,13 @@
width: 100%;
}
}
}

#content-desktop {display: block;}
#content-mobile {display: none;}

@include media-breakpoint-down(md) {

#content-desktop {display: none;}
#content-mobile {display: block;}
}
}
Loading

0 comments on commit 16196ec

Please sign in to comment.