Skip to content

Commit

Permalink
feat: add Mermaid and tables, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhart1010 committed May 26, 2024
1 parent 71c90d5 commit ec3943a
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 4 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ We believe that everyone should be able to theme HAM websites according to their

{% youtube 0FKaIiRhUME %}

<pre class="mermaid">
graph TD
A[Client] --> B[Load Balancer]
B --> C[Server01]
B --> D[Server02]
</pre>

## Usage
### For [GitHub Pages](https://pages.github.com)
If you would like to add this theme into your GitHub Pages website, please just add the following on your `_config.yml`
Expand All @@ -90,7 +97,7 @@ gem "minima"
on your `Gemfile` with

```gemspec
gem "jekyll-ham", "~> 0.3.3"
gem "jekyll-ham", "~> 1.1.0"
```

Also don't forget to change the `theme` configuration on your `_config.yml` to `jekyll-ham` instead of `minima`.
Expand Down Expand Up @@ -280,7 +287,9 @@ Copyright (c) 2021-2023 Reinhart Previano Koentjoro.

This project is distributed under MIT License, and also uses the following open-source components:

+ Bootstrap Icons (<https://github.com/twbs/icons>) - Copyright (c) 2019-2023 The Bootstrap Authors, MIT License
+ Bootstrap Icons (<https://github.com/twbs/icons>) - Copyright (c) 2019-2024 The Bootstrap Authors, MIT License
+ Halfmoon (<https://github.com/halfmoonui/halfmoon>) - Copyright (c) 2020 Halfmoon UI, MIT License
+ Mermaid (<https://github.com/annexare/toURI>) - Copyright (c) 2014-2024 Knut Sveidqvist, MIT License
+ OneDarkJekyll (<https://github.com/mgyongyosi/OneDarkJekyll>) - Copyright (c) 2016 Mihály Gyöngyösi, MIT License
+ Simple-Jekyll-Search (<https://github.com/christian-fei/Simple-Jekyll-Search>) - Copyright (c) 2015 Christian Fei, MIT License
+ toURI (<https://github.com/annexare/toURI>) - Copyright (c) 2014 Annexare Studio, MIT License
5 changes: 5 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,10 @@
<script src="{{ site.url }}/assets/halfmoon.min.js"></script>
<!-- Bootstrap JS for color modes -->
<script src="{{ site.url }}/assets/bootstrap-color-modes.js"></script>
<!-- Load Mermaid Diagrams -->
<script type="module">
import mermaid from "{{ site.url }}/assets/mermaid.esm.min.js";
mermaid.initialize({ startOnLoad: true });
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h5 id="contribute" class="sidebar-title">Contribute to This Page</h5>
</div>
</div>

<script src="https://unpkg.com/[email protected]/lib/toURI.js"></script>
<script src="{{ site.url }}/assets/toURI.js"></script>
<script src="{{ site.url }}/assets/entry-parser.js"></script>
<script>
var siteName = '{{ site.ham.site_name }}';
Expand Down
4 changes: 4 additions & 0 deletions assets/mermaid.esm.min.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { b9 as f } from "./mermaid-9f2aa176.js";
export {
f as default
};
23 changes: 23 additions & 0 deletions assets/tables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Utility stylesheet for rendering tables */

table:not([data-ham-ignore="true"]) {
border-collapse: collapse;
margin-top: 1rem;
margin-bottom: 1rem;
}

table:not([data-ham-ignore="true"]) td, table:not([data-ham-ignore="true"]) th {
padding: 0.5rem;
}

table:not([data-ham-ignore="true"]) thead {
background: var(--bs-primary-bg-subtle);
}

table:not([data-ham-ignore="true"]) tr {
border-bottom: solid 1px var(--bs-primary-700);
}

[data-bs-theme="dark"] table:not([data-ham-ignore="true"]) tr {
border-bottom: solid 1px var(--bs-primary-300);
}
142 changes: 142 additions & 0 deletions assets/toURI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Version 1.0.4

/*
* String transliteration for URI generation purposes.
* Adds .toURI() to String's prototype for browser usage.
* With Node.js & AMD support.
*
* @link http://annexare.com/
* @license MIT
*/

;(function () {
'use strict';

var pairs = {
// Cyrillic
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g',
'д': 'd', 'е': 'e', 'ё': 'yo', 'ж': 'zh',
'з': 'z', 'и': 'y', 'й': 'j',
'кс': 'x', 'к': 'k',
'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
'п': 'p', 'р': 'r', 'с': 's', 'т': 't',
'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'ts',
'ч': 'ch', 'ш': 'sh', 'щ': 'shch','ъ': '',
'ы': 'y', 'ь': '', 'э': 'e',
// Part is done as: http://zakon4.rada.gov.ua/laws/show/55-2010-%D0%BF
// But don't agree with "Гг | Hh", nobody talks like that.
'^ю': 'yu', '\\s+ю': ' yu', 'ю': 'iu',
'^я': 'ya', '\\s+я': ' ya', 'я': 'ia',
'^є': 'ye', '\\s+є': ' ye', 'є': 'ie',
'і': 'i',
'^ї': 'yi', '\\s+ї': ' yi', 'ї': 'i',
'ґ': 'gh',
// Symbols & Accents
'\\.': '_',
'&': 'and',
'∞': 'infinity',
'♥': 'love',
'ä|æ|ǽ': 'ae',
'ö|œ': 'oe',
'ü': 'ue',
'à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª': 'a',
'ç|ć|ĉ|ċ|č': 'c',
'ð|ď|đ': 'd',
'è|é|ê|ë|ē|ĕ|ė|ę|ě': 'e',
'ĝ|ğ|ġ|ģ': 'g',
'ĥ|ħ': 'h',
'ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı': '',
'ĵ': 'j',
'ķ': 'k',
'ĺ|ļ|ľ|ŀ|ł': 'l',
'ñ|ń|ņ|ň|ʼn': 'n',
'ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º': 'o',
'ŕ|ŗ|ř': 'r',
'ś|ŝ|ş|š|ſ': 's',
'ţ|ť|ŧ': 't',
'ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ': 'u',
'ý|ÿ|ŷ': 'y',
'ŵ': 'w',
'ź|ż|ž': 'z',
'ß': 'ss',
'ij': 'ij',
'ƒ': 'f',
// Currencies
'\\$': 'USD',
'€': 'EUR',
'£': 'GBP',
'₴': 'UAH',
'¢': 'cent'
},
isRU = /ы|ъ|э|ё|ъ|(\s|^)и|жь|чь|шь|иа|ие|ии|ио|иу|аи|еи|ои|уи|цк|ец(\s|$)/,
isUA = /є|i|ї|ґ|зьк|ськ|цьк|ць(\s|$)|(нн|тт|чч)[юя]/,
strtr = function (string, pairs) {
// Just like this:
// http://php.net/manual/en/function.strtr.php
var str = string;
for (var key in pairs) if (pairs.hasOwnProperty(key)) {
str = str.replace(new RegExp(key, 'g'), pairs[key]);
}
return str;
},
transliterate = function (separateWith) {
var text = this.toString().trim(),
space = ' ',
separator = separateWith || space,
isUri = (separator !== space);

if (!text) {
return '';
}

if (isUri) {
text = text
// Strip tags
.replace(/(<([^>]+)>)/ig, '');

if (!text) {
return '';
}
}

text = text.toLowerCase();
pairs['и'] = ((text.search(isRU) !== -1) && (text.search(isUA) === -1)) ? 'i' : 'y';

text = strtr(text, pairs);

if (isUri) {
text = text
// Strip whitespace into separator
.replace(/\s+/g, separator)
// Slashes, ":"
.replace(/[\/\\:]+/g, separator)
// Unsupported symbols
.replace(/[^\d\w\-\+_]+/g, separator)
// Multiple dashes
.replace(new RegExp('(' + separator + ')+', 'g'), separator)
.replace(/\-([+_])\-/g, '$1')
// Trim text for specific chars
.replace(/^[\-_]+|[\-_]+$/g, '');
}

return text;
},
toURI = function (separateWith) {
return transliterate.call(this, separateWith || '-');
};

if (typeof module !== 'undefined' && module.exports) {
module.exports = toURI;
} else if (typeof define !== 'undefined' && define.amd) {
define([], function() {
return toURI;
});
} else {
this.transliterate = function (text, separateWith) {
return transliterate.call(text, separateWith);
};
this.toURI = function (text, separateWith) {
return toURI.call(text, separateWith);
};
}
}.call(this));
2 changes: 1 addition & 1 deletion jekyll-ham.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "jekyll-ham"
spec.version = "1.0.4"
spec.version = "1.1.0"
spec.authors = ["Reinhart Previano Koentjoro"]
spec.email = ["[email protected]"]

Expand Down

0 comments on commit ec3943a

Please sign in to comment.