Skip to content

Commit

Permalink
docs: migrate to Hugo
Browse files Browse the repository at this point in the history
Hopefully will mean less of a headache with docusaurus dependencies. Closes #407
  • Loading branch information
Simon Prochazka authored and fallion committed Aug 15, 2021
1 parent db8670c commit b903dda
Show file tree
Hide file tree
Showing 196 changed files with 1,327 additions and 12,330 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/documentation.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributing

Contributions are most welcome. Please check the [CONTRIBUTING](https://commitsar.tech/docs/contributing/get_started) section of documentation.
Contributions are most welcome. Please check the [CONTRIBUTING](https://commitsar.aevea.ee/contributing/get_started) section of documentation.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Tool to make sure your commits are compliant with [conventional commits](https:/

## Usage

Please check [Documentation](https://commitsar.tech).
Please check [Documentation](https://commitsar.aevea.ee).

## Contributing

Contributions are most welcome. Please check the [CONTRIBUTING](https://commitsar.tech/docs/contributing/get_started) section of documentation.
Contributions are most welcome. Please check the [CONTRIBUTING](https://commitsar.aevea.ee/contributing/get_started) section of documentation.

## Sponsoring

Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public
6 changes: 6 additions & 0 deletions docs/archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

19 changes: 19 additions & 0 deletions docs/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
baseURL = "https://commitsar.aevea.ee"
title = "Commitsar"
theme = "hugo-geekdoc"

pluralizeListTitles = false

# Geekdoc required configuration
pygmentsUseClasses = true
pygmentsCodeFences = true
disablePathToLower = true

# Needed for mermaid shortcodes
[markup]
[markup.goldmark.renderer]
# Needed for mermaid shortcode
unsafe = true
[markup.tableOfContents]
startLevel = 1
endLevel = 9
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion www/docs/usage/github.md → docs/content/usage/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Github Actions

### JIRA pipeline

When using [JIRA](https://commitsar.tech/docs/configuration/config-file) make sure to set `actions/checkout@v2` to pull from the pull_request HEAD. Github uses a single merge commit by default which is not referenced in git. This will cause commitsar JIRA check to fail as this commit will not be found by the API getting queried for PR by commit.
When using [JIRA](https://commitsar.aevea.ee/configuration/config-file) make sure to set `actions/checkout@v2` to pull from the pull_request HEAD. Github uses a single merge commit by default which is not referenced in git. This will cause commitsar JIRA check to fail as this commit will not be found by the API getting queried for PR by commit.

### actions/checkout@v2

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions docs/themes/hugo-geekdoc/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2021 Robert Kaussow

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 changes: 44 additions & 0 deletions docs/themes/hugo-geekdoc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Geekdoc

[![Build Status](https://img.shields.io/drone/build/thegeeklab/hugo-geekdoc?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/hugo-geekdoc)
[![Hugo Version](https://img.shields.io/badge/hugo-0.83-blue.svg)](https://gohugo.io)
[![GitHub release](https://img.shields.io/github/v/release/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/releases/latest)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/graphs/contributors)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/blob/main/LICENSE)

Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. You can find a demo and the full documentation at [https://geekdocs.de](https://geekdocs.de).

![Desktop and mobile preview](https://raw.githubusercontent.com/thegeeklab/hugo-geekdoc/main/images/readme.png)

## Build and release process

This theme is subject to a CI driven build and release process common for software development. During the release build, all necessary assets are automatically built by [gulp](https://gulpjs.com/) and bundled in a release tarball. You can download the latest release from the GitHub [release page](https://github.com/thegeeklab/hugo-geekdoc/releases).

Due to the fact that `gulp` is used as pre-processor the theme cannot be used from the main branch by default. If you want to use the theme from a cloned branch instead of a release tarball you'll need to install `gulp` locally and run the default pipeline once to create all required assets.

```Shell
# install required packages from package.json
npm install

# run gulp pipeline to build required assets
npx gulp default
```

See the [Getting Started Guide](https://geekdocs.de/usage/getting-started/) for details about the different setup options.

## Contributors

Special thanks goes to all [contributors](https://github.com/thegeeklab/hugo-geekdoc/graphs/contributors). If you would like to contribute,
please see the [instructions](https://github.com/thegeeklab/hugo-geekdoc/blob/main/CONTRIBUTING.md).

Geekdoc is inspired and partially based on the [hugo-book](https://github.com/alex-shpak/hugo-book) theme, thanks [Alex Shpak](https://github.com/alex-shpak/) for your work.

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/thegeeklab/hugo-geekdoc/blob/main/LICENSE) file for details.

The used SVG icons and generated icon fonts are licensed under the license of the respective icon pack:

- Font Awesome: [CC BY 4.0 License](https://github.com/FortAwesome/Font-Awesome#license)
- IcoMoon Free Pack: [GPL/CC BY 4.0](https://icomoon.io/#icons-icomoon)
- Material Icons: [Apache License 2.0](https://github.com/google/material-design-icons/blob/main/LICENSE)
1 change: 1 addition & 0 deletions docs/themes/hugo-geekdoc/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.17.1
7 changes: 7 additions & 0 deletions docs/themes/hugo-geekdoc/archetypes/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "{{ .Name | humanize | title }}"
weight: 1
# geekdocFlatSection: false
# geekdocToc: 6
# geekdocHidden: false
---
4 changes: 4 additions & 0 deletions docs/themes/hugo-geekdoc/archetypes/posts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
---
171 changes: 171 additions & 0 deletions docs/themes/hugo-geekdoc/assets/js/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
'use strict';

{{ $searchDataFile := printf "%s.search-data.json" .Language.Lang }}
{{ $searchData := resources.Get "search-data.json" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify }}

(function() {
const input = document.querySelector('#gdoc-search-input');
const results = document.querySelector('#gdoc-search-results');
let showParent = {{ if .Site.Params.GeekdocSearchShowParent }}true{{ else }}false{{ end }}

if (input) {
input.addEventListener('focus', init);
input.addEventListener('keyup', search);
}

function init() {
input.removeEventListener('focus', init); // init once

loadScript('{{ index .Site.Data.assets "js/groupBy.min.js" | relURL }}');
loadScript('{{ index .Site.Data.assets "js/flexsearch.min.js" | relURL }}', function() {
const indexCfgDefaults = {
tokenize: 'forward'
}
const indexCfg = {{ with .Scratch.Get "geekdocSearchConfig" }}{{ . | jsonify }}{{ else }}indexCfgDefaults{{ end }};
const dataUrl = '{{ $searchData.RelPermalink }}'

indexCfg.document = {
key: 'id',
index: ['title', 'content'],
store: ['title', 'href', 'parent'],
};

const index = new FlexSearch.Document(indexCfg);
window.geekdocSearchIndex = index;

getJson(dataUrl, function(data) {
data.forEach(obj => {
window.geekdocSearchIndex.add(obj);
});
});
});
}

function search() {
const searchCfg = {
enrich: true,
limit: 10
};

while (results.firstChild) {
results.removeChild(results.firstChild);
}

if (!input.value) {
return results.classList.remove('has-hits');
}

let searchHits = flattenHits(window.geekdocSearchIndex.search(input.value, searchCfg));
if (searchHits.length < 1) {
return results.classList.remove('has-hits');
}

results.classList.add('has-hits');

if (showParent === true) {
searchHits = groupBy(searchHits, hit => hit.parent);
}

const items = [];

if (showParent === true) {
for (const section in searchHits) {
const item = document.createElement('li'),
title = item.appendChild(document.createElement('span')),
subList = item.appendChild(document.createElement('ul'));

title.textContent = section;
createLinks(searchHits[section], subList);

items.push(item);
}
} else {
const item = document.createElement('li'),
title = item.appendChild(document.createElement('span')),
subList = item.appendChild(document.createElement('ul'));

title.textContent = 'Results';
createLinks(searchHits, subList);

items.push(item);
}

items.forEach(item => {
results.appendChild(item);
})
}

/**
* Creates links to given fields and either returns them in an array or attaches them to a target element
* @param {Object} fields Page to which the link should point to
* @param {HTMLElement} target Element to which the links should be attatched
* @returns {Array} If target is not specified, returns an array of built links
*/
function createLinks(pages, target) {
const items = [];

for (const page of pages) {
const item = document.createElement("li"),
entry = item.appendChild(document.createElement("span")),
a = entry.appendChild(document.createElement("a"));

entry.classList.add('flex')

a.href = page.href;
a.textContent = page.title;
a.classList.add('gdoc-search__entry')

if (target) {
target.appendChild(item);
continue
}

items.push(item);
}

return items;
}

function fetchErrors(response) {
if (!response.ok) {
throw Error(response.statusText);
}
return response;
}

function getJson(src, callback) {
fetch(src)
.then(fetchErrors)
.then(response => response.json())
.then(json => callback(json))
.catch(function(error) {
console.log(error);
});
}

function flattenHits(results) {
const items = [];
const map = new Map();

for (const field of results) {
for (const page of field.result) {
if(!map.has(page.doc.href)){
map.set(page.doc.href, true);
items.push(page.doc);
}
}
}

return items
}

function loadScript(src, callback) {
let script = document.createElement('script');
script.defer = true;
script.async = false;
script.src = src;
script.onload = callback;

document.body.appendChild(script);
}
})();
12 changes: 12 additions & 0 deletions docs/themes/hugo-geekdoc/assets/search-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{{ range $index, $page := (where .Site.Pages "Params.GeekdocProtected" "ne" true) }}
{{ if ne $index 0 }},{{ end }}
{
"id": {{ $index }},
"href": "{{ $page.RelPermalink }}",
"title": {{ (partial "title" $page) | jsonify }},
"parent": {{ with $page.Parent }}{{ (partial "title" .) | jsonify }}{{ else }}""{{ end }},
"content": {{ $page.Plain | jsonify }}
}
{{ end }}
]
Loading

0 comments on commit b903dda

Please sign in to comment.