Skip to content

Commit

Permalink
First basic setup of docs using vitepress, includes updating github a…
Browse files Browse the repository at this point in the history
…ction to deploy docs to '/docs' location in web app
  • Loading branch information
jsheunis committed Sep 5, 2024
1 parent 01367b1 commit f432d21
Show file tree
Hide file tree
Showing 10 changed files with 1,506 additions and 270 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/sitebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ jobs:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm ci
- name: Build Vue.js app
run: npm run build
- name: Build VitePress docs
run: |
cd .docs
npm ci
npm run build
cd ..
# Move VitePress build to the /dist/docs folder
mv .docs/.vitepress/dist dist/docs
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
- name: Upload artifacts (both Vue.js app and VitePress docs)
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ node_modules
/dist
_ignore

# VItepress
docs/.vitepress/dist
docs/.vitepress/cache

# local env files
.env.local
.env.*.local
Expand Down
31 changes: 31 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
base: "/shacl-vue/docs/",
title: "shacl-vue",
description: "Automatic generation of user interfaces from SHACL",
head: [['link', { rel: 'icon', href: '/shacl-vue/docs/favicon.ico' }]],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: '/shacl_vue.svg',
nav: [
{ text: 'Home', link: '/' },
{ text: 'Examples', link: '/markdown-examples' }
],

sidebar: [
{
text: 'Examples',
items: [
{ text: 'Markdown Examples', link: '/markdown-examples' },
{ text: 'Runtime API Examples', link: '/api-examples' }
]
}
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/psychoinformatics-de/shacl-vue' }
]
}
})
49 changes: 49 additions & 0 deletions docs/api-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
outline: deep
---

# Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
24 changes: 24 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "shacl-vue"
text: "Automatic generation of user interfaces from SHACL"
actions:
- theme: brand
text: Markdown Examples
link: /markdown-examples
- theme: alt
text: API Examples
link: /api-examples

features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

85 changes: 85 additions & 0 deletions docs/markdown-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Markdown Extension Examples

This page demonstrates some of the built-in markdown extensions provided by VitePress.

## Syntax Highlighting

VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:

**Input**

````md
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````

**Output**

```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```

## Custom Containers

**Input**

```md
::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::
```

**Output**

::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::

## More

Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
Binary file added docs/public/favicon.ico
Binary file not shown.
84 changes: 84 additions & 0 deletions docs/public/shacl_vue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f432d21

Please sign in to comment.