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

Structured navigation for docs #29

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'DexieError'
index: yes
---
*since v.1.3.3*

Expand Down
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.
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.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ gfm_quirks: paragraph_end

# Build settings
markdown: kramdown

collections:
tutorial:
output: true
permalink: /docs/Tutorial/:path/
api_ref:
output: true
permalink: /docs/:path/
misc:
output: true
permalink: /docs/:path/
19 changes: 19 additions & 0 deletions _includes/nav-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% comment %}
Use first item as index
{% endcomment %}
{% assign index = include.items | first %}
{% assign pages = include.items | shift %}

<h{{ include.level }}>
<a href="{{ index.url }}">
{{ index.title }}
</a>
</h{{ include.level }}>

<ul class="docs-toc">
{% for page in pages %}
<li>
<a href="{{ page.url }}">{{ page.title }}</a>
</li>
{% endfor %}
</ul>
26 changes: 18 additions & 8 deletions _layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,29 @@ <h1 class="col-xs-12 col-md-10">{{ page.title }}</h1>
</div>
<div class="col-xs-12 col-md-4">
<div class="row docs-page-subheader">
<h3>Table of Contents</h3>
<h3><a href="{% link docs/index.md %}">Dexie Docs</a></h3>
<div class="docs-toc-wrapper">

{% assign pages = site.tutorial | sort: 'weight' %}
{% include nav-index.html items=pages level=4 %}

{% assign pages = site.misc | sort: "title" %}
<h4>Misc</h4>
<ul class="docs-toc">
{% assign pages = site.pages | sort:"title" %}
{% for page in pages %}
{% if page.layout == 'docs' %}
<li>
<a href="{{ page.url | replace: '.html', ''}}">{{ page.title }}</a>
</li>
{% endif %}
<li>
<a href="{{ page.url }}">{{ page.title }}</a>
</li>
{% endfor %}
</ul>

<h4><a href="{% link docs/API-Reference.md %}">API Reference</a></h4>
{% assign groups = site.api_ref | group_by_exp: "item", "item.relative_path | split: '/' | shift | first" %}
{% for group in groups %}
{% assign pages = group.items | sort: "title" | sort: "index", "last" %}
{% include nav-index.html items=pages level=5 %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>
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.
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.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Best Practices'
weight: 50
---

### 1. Understand Promises
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: docs
title: 'Building Addons'
subtitle: Dexie is designed for being extended by addons.
weight: 90
---

## Methods for Extending Dexie
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Consuming Dexie as a module'
weight: 20
---

## Short Version
Expand Down
1 change: 1 addition & 0 deletions docs/Tutorial/Design.md → _tutorial/Design.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Design'
weight: 30
---

### The Dexie class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Getting Started'
weight: 10
---

Dexie.js can be consumed as a module. But let's skip that for now and just show the simplest possible setup. You will just need a text editor and a web browser.
Expand Down
1 change: 1 addition & 0 deletions docs/Tutorial/Hello-World.md → _tutorial/Hello-World.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Hello World'
weight: 150
---

```html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Migrating existing DB to Dexie'
weight: 60
---

Dexie can open any indexedDB database, no matter if you've created it via raw indexedDB or another indexedDB wrapper.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Understanding the basics'
weight: 120
---

## Creating Database vs opening existing
Expand Down
1 change: 1 addition & 0 deletions docs/Tutorial/index.md → _tutorial/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'Tutorial'
permalink: /docs/Tutorial/
---
[Getting started](/docs/Tutorial/Getting-started)

Expand Down
6 changes: 4 additions & 2 deletions assets/css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ img.dexie-logo-icon {
.getstarted {
width: 260px;
}

}

table {
Expand Down Expand Up @@ -172,10 +172,12 @@ table tr:nth-child(2n) {
}

.docs-toc-wrapper {
padding-left: 10px;
}

.docs-toc {
padding: 10px;
padding-left: 10px;
padding-bottom: 10px;
}

.docs-toc li {
Expand Down
1 change: 1 addition & 0 deletions docs/API-Reference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: docs
title: 'API Reference'
permalink: /docs/API-Reference/
---

### Classes
Expand Down