Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding manon-docs hugo theme and support #91

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
public/
resources/
static/
Expand Down
16 changes: 14 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# manon-docs
# Manon Docs

## Introduction

Uses [Hugo](https://gohugo.io/) to generate a static documentation site for
manon.


## Developing

```
$ docker build -t manon-docs .
$ docker run -it --rm -p 1313:1313 -v $(pwd):/site manon-docs server --bind=0.0.0.0 --baseURL=localhost:1313
```
```

### Updating the theme

The theme is located in [themes/manon](themes/manon).
10 changes: 7 additions & 3 deletions docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ weight = 2

[markup.goldmark]

[markup.goldmark.parser]
autoHeadingID = false

[markup.goldmark.renderer]
unsafe = true

[markup.goldmark.parser]
autoHeadingID = true

[markup.highlight]
codeFences = false
noClasses = true
2 changes: 0 additions & 2 deletions docs/content/nl/docs/Bibliotheek/Componenten/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ weight: 2
description: >
Componenten zijn ...
---

# Components
26 changes: 26 additions & 0 deletions docs/content/nl/docs/Bibliotheek/Componenten/accordion.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,31 @@ openklappen om meer informatie te tonen.
#### HTML voorbeeld

```html
<ul class="accordion">
<li>
<button id="example-accordion-ul-item-1">Voorbeeld-onderwerp 1</button>
<div aria-labelledby="example-accordion-ul-item-1">
<h1>Titel van de content binnen het accordeon-element</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum suscipit egestas leo, eu semper erat congue at. Nulla pellentesque nunc nisl, at elementum ex aliquam ac. Fusce sed justo ullamcorper, eleifend nibh a, fringilla lorem. Aliquam erat volutpat. Aenean risus sem, tempor at rhoncus in, suscipit hendrerit arcu. Suspendisse ultricies semper sapien eget lobortis. Phasellus ut sodales sem. Aenean quis libero gravida, fringilla odio venenatis, condimentum lorem.</p>
<ul>
<li>Lorem ipsum</li>
<li>Dolor sit amet</li>
<li>Consectetur adepiscing elit.</li>
</ul>
</div>
</li>
<li>
<button id="example-accordion-ul-item-2">Voorbeeld-onderwerp 2</button>
<div aria-labelledby="example-accordion-ul-item-2">
<h1>Titel van de content binnen het accordeon-element</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum suscipit egestas leo, eu semper erat congue at. Nulla pellentesque nunc nisl, at elementum ex aliquam ac. Fusce sed justo ullamcorper, eleifend nibh a, fringilla lorem. Aliquam erat volutpat. Aenean risus sem, tempor at rhoncus in, suscipit hendrerit arcu. Suspendisse ultricies semper sapien eget lobortis. Phasellus ut sodales sem. Aenean quis libero gravida, fringilla odio venenatis, condimentum lorem.</p>
<ul>
<li>Lorem ipsum</li>
<li>Dolor sit amet</li>
<li>Consectetur adepiscing elit.</li>
</ul>
</div>
</li>
</ul>
```

2 changes: 0 additions & 2 deletions docs/content/nl/docs/Bibliotheek/Elementen/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ weight: 1
description: >
Elementen zijn ...
---

# Elementen
2 changes: 0 additions & 2 deletions docs/content/nl/docs/Bibliotheek/Layout/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ weight: 3
description: >
Hoe je een layout maakt
---

# Layout
2 changes: 0 additions & 2 deletions docs/content/nl/docs/Bibliotheek/Maatwerk/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ weight: 5
description: >
Hoe Manon te configureren
---

# Maatwerk
2 changes: 0 additions & 2 deletions docs/content/nl/docs/Bibliotheek/Toegankelijkheid/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ weight: 4
description: >
Toegankelijkheid ondersteuning van Manon
---

# Toegankelijkheid
2 changes: 0 additions & 2 deletions docs/content/nl/docs/Bibliotheek/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ description: >
Overzicht van alle componenten en elementen in het Manon CSS Library en
hoe deze te gebruiken.
---

# Bibliotheek
2 changes: 0 additions & 2 deletions docs/content/nl/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ title: "Documentatie"
linkTitle: "Documentatie"
weight: 2
---

# Documentatie
5 changes: 5 additions & 0 deletions docs/themes/manon-docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
public/
resources/
static/
.hugo_build.lock
9 changes: 9 additions & 0 deletions docs/themes/manon-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Manon Docs Theme

## Using the theme

Using the theme in a hugo site

## Developing

How to develop and update the theme
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<section>
<h1 id="{{ .Title | plainify | htmlUnescape | anchorize }}">{{ .Title }}</h1>
{{ $parent := .Page }}

{{/* Make sure we get all the unique pages */}}
Expand All @@ -8,7 +9,7 @@

{{ range $pages }}
<p>
<h2>
<h2 id="{{ .Title | plainify | htmlUnescape | anchorize }}">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using the anchorize filter makes the other filters unnecessary since it already sanitizes the input

<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h2>
<p>{{ .Description | markdownify }}</p>
Expand Down
29 changes: 23 additions & 6 deletions docs/themes/manon-docs/layouts/partials/sidemenu.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{- $headers := findRE "<h[1-4].*?>(.|\n])+?</h[1-4]>" .Content -}}

<nav>
<ul>
{{/* On section pages (_index.md) we can expect content and we want to
differentiate between rendering the table of content for those or when
we need to render by the pages */}}
<nav>
{{ if gt (len .Content) 0 }}
<ul>
{{- $headers := findRE "<h[1-4].*?>(.|\n])+?</h[1-4]>" .Content -}}
{{ range $headers }}

{{ $lastLevel := $.Scratch.Get "lastLevel" }}
Expand Down Expand Up @@ -29,5 +32,19 @@
{{ end }}

{{ end }}
</ul>
</nav>

</ul>
{{ else }}
<ul>
{{ $parent := .Page }}

{{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
{{ $pages = (where $pages ".Parent" "!=" nil) }}
{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }}

{{ range $pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
</nav>