Skip to content

Commit

Permalink
feat(genji-docs): init docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini committed Mar 5, 2024
1 parent 3a11f6e commit be77aee
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/genji-docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineConfig } from "vitepress";

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Genji",
description: "The Interactive Markdown extension",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "Guide", link: "/markdown-examples" },
{ text: "Reference", link: "/api-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/vuejs/vitepress" },
],
},
});
49 changes: 49 additions & 0 deletions packages/genji-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 packages/genji-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: "Genji"
text: "The interactive Markdown extension"
tagline: Create interactive documents with just Markdown.
actions:
- theme: brand
text: Get Started
link: /markdown-examples
- theme: alt
text: What is Genji?
link: /api-examples

features:
- title: Executable code blocks
details: Code blocks in Markdown are executable, allowing them to display their evaluated values, which can then be referenced by other code blocks.
- title: Interactive via reactivity
details: Built-in inputs and custom reactive variables can be defined to capture user input, triggering a re-render of the code blocks that reference them.
- title: Compatible with popular SSG frameworks
details: Themes and plugins are available for integrating Genji into popular SSG frameworks, embracing their features and ensuring seamless experience with existing tools.
---
85 changes: 85 additions & 0 deletions packages/genji-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).
15 changes: 15 additions & 0 deletions packages/genji-docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "genji-docs",
"private": true,
"description": "The documentation for Genji",
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
},
"author": "https://github.com/pearmini",
"license": "MIT",
"devDependencies": {
"vitepress": "^1.0.0-rc.44"
}
}

0 comments on commit be77aee

Please sign in to comment.