Skip to content

Commit

Permalink
Merge branch 'release-0.9.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
thingsym committed Aug 2, 2020
2 parents e9cb767 + f38b83a commit 2207378
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 26 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The Techdoc is a Hugo Theme for technical documentation.

![The Techdoc screenshot](https://raw.githubusercontent.com/thingsym/hugo-theme-techdoc/master/images/screenshot.png)

- Hugo Themes page: [https://themes.gohugo.io/hugo-theme-techdoc/](https://themes.gohugo.io/hugo-theme-techdoc/)
- Demo site: [https://themes.gohugo.io/theme/hugo-theme-techdoc/](https://themes.gohugo.io/theme/hugo-theme-techdoc/)
- Download: [https://github.com/thingsym/hugo-theme-techdoc](https://github.com/thingsym/hugo-theme-techdoc)

## Features

* Modern, Simple layout
Expand All @@ -12,6 +16,7 @@ The Techdoc is a Hugo Theme for technical documentation.
* Table Of Contents for the page (selective)
* Theme color
* Edit link to documentation repository
* Header link to HTML headings
* Custom Shortcodes
* Search Shortcode powered by [Algolia](https://www.algolia.com/)
* Open Graph
Expand Down Expand Up @@ -119,16 +124,17 @@ tree .
│   │   ├── list.html
│   │   └── single.html
│   └── shortcodes
│       ├── button.html
│       └── panel.html
│       └── search.html
│   ├── button.html
│   ── panel.html
│   └── search.html
├── LICENSE.md
├── package.json
├── package-lock.json
├── README.md
├── resources
├── src
│   ├── js
│   │   ├── headerlink.js
│   │   ├── jquery.backtothetop
│   │   │   ├── jquery.backtothetop.js
│   │   │   └── jquery.backtothetop.min.js
Expand Down Expand Up @@ -215,6 +221,10 @@ Small patches and bug reports can be submitted a issue tracker in Github. Forkin

## Changelog

* Version 0.9.3 - 2020.08.02
* remove jQuery dependency with keydown nav
* add header link

* Version 0.9.2 - 2020.06.14
* add note and sample to document
* fix tableOfContents endLevel
Expand Down Expand Up @@ -301,4 +311,4 @@ Techdoc bundles the following third-party resources:

[thingsym](https://github.com/thingsym)

Copyright (c) 2017-2020 by thingsym
Copyright (c) 2017-2020 by [thingsym](https://management.thingslabo.com/)
2 changes: 1 addition & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enableMissingTranslationPlaceholders = false
# Source Code repository section
description = "put your description"
github_repository = "https://github.com/thingsym/hugo-theme-techdoc"
version = "0.9.2"
version = "0.9.3"

# Documentation repository section
# documentation repository (set edit link to documentation repository)
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For an example of `config.toml`, see [config.toml](https://github.com/thingsym/h
# Source Code repository section
description = "put your description"
github_repository = "https://github.com/thingsym/hugo-theme-techdoc"
version = "0.9.2"
version = "0.9.3"

# Documentation repository section
# documentation repository (set edit link to documentation repository)
Expand Down Expand Up @@ -80,7 +80,7 @@ default: `https://github.com/thingsym/hugo-theme-techdoc`

The version of souce code

default: `0.9.2`
default: `0.9.3`

#### `github_doc_repository`

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hugo-theme-techdoc",
"version": "0.9.2",
"version": "0.9.3",
"description": "The Techdoc is a Hugo Theme for technical documentation.",
"main": "gulpfile.js",
"author": "Thingsym",
Expand Down
22 changes: 22 additions & 0 deletions src/js/headerlink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(function() {
document.addEventListener('DOMContentLoaded', function(){
const targetElements = document.querySelector('main').querySelectorAll('h1, h2, h3, h4, h5, h6');

targetElements.forEach(( el ) => {
if (el.id) {
const headerlink = document.createElement('a');
headerlink.setAttribute('class', 'headerlink');
headerlink.setAttribute('href', '#' + el.id);
headerlink.setAttribute('title', 'Permalink to this headline');

const icon = document.createElement('i');
icon.setAttribute('class', 'fas fa-hashtag');
icon.setAttribute('aria-hidden', 'true');

headerlink.append(icon);

el.append(headerlink);
}
});
});
})();
26 changes: 11 additions & 15 deletions src/js/keydown-nav.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
(function($) {
$(document).ready(function() {
$('.nav-prev').on( 'click', function() {
location.href = $(this).attr('href');
});
$('.nav-next').on('click', function() {
location.href = $(this).attr('href');
});
(function() {
document.addEventListener('DOMContentLoaded', function(){
const nav_prev = document.querySelector('.nav-prev');
const nav_next = document.querySelector('.nav-next');

$(document).on( 'keydown', function(e) {
// prev links - left arrow key
if(e.which == '37') {
$('.nav-prev').click();
// prev links - left arrow key
document.addEventListener( 'keydown', event => {
if (nav_prev && event.keyCode === 37) {
location.href = nav_prev.getAttribute('href');
}

// next links - right arrow key
if(e.which == '39') {
$('.nav-next').click();
if (nav_next && event.keyCode === 39) {
location.href = nav_next.getAttribute('href');
}
});
});
})(jQuery);
})();
1 change: 1 addition & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require( './sidebar-menu.js' );
require( './keydown-nav.js' );
require( './jquery.backtothetop/jquery.backtothetop.min.js' );
require( './headerlink.js' );
5 changes: 5 additions & 0 deletions src/scss/_component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ figure > figcaption h4 {

}

.headerlink > .svg-inline--fa {
margin-left: .4rem;
width: .8rem;
}

.ais-SearchBox {
.ais-SearchBox-input {
width: 70%;
Expand Down
5 changes: 5 additions & 0 deletions static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,11 @@ figure > figcaption h4 {
margin-left: 10rem;
}

.headerlink > .svg-inline--fa {
margin-left: .4rem;
width: .8rem;
}

.ais-SearchBox .ais-SearchBox-input {
width: 70%;
}
Expand Down
2 changes: 1 addition & 1 deletion static/css/theme.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/js/bundle.js

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

0 comments on commit 2207378

Please sign in to comment.