Skip to content

Commit

Permalink
feat(index): new plugin vitepress-plugin-index (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekomeowww authored Nov 10, 2024
1 parent 2293fd3 commit a77cb30
Show file tree
Hide file tree
Showing 127 changed files with 1,946 additions and 595 deletions.
10 changes: 0 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@
"jsonc",
"yaml"
],
"unocss.root": [
".",
"./docs",
"./packages/vitepress-plugin-enhanced-readabilities",
"./packages/vitepress-plugin-git-changelog",
"./packages/vitepress-plugin-graph-view",
"./packages/vitepress-plugin-inline-link-preview",
"./packages/vitepress-plugin-page-properties",
"./packages/vitepress-plugin-thumbnail-hash"
],
"typescript.tsdk": "node_modules/typescript/lib",
"i18n-ally.localesPaths": [
"packages/**/src/locales"
Expand Down
24 changes: 24 additions & 0 deletions docs/.vitepress/twoslashConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,48 @@ export const compilerOptions = {
'@nolebase/ui': [
'../packages/ui/src/index.ts',
],
'@nolebase/ui-asciinema': [
'../packages/ui-asciinema/src/index.ts',
],
'@nolebase/ui-rive-canvas': [
'../packages/ui-rive-canvas/src/index.ts',
],
'@nolebase/unconfig-vitepress/*': [
'../packages/unconfig-vitepress/src/*',
],
'@nolebase/vitepress-plugin-data-driver/*': [
'../packages/vitepress-plugin-data-driver/src/*',
],
'@nolebase/vitepress-plugin-enhanced-readabilities/*': [
'../packages/vitepress-plugin-enhanced-readabilities/src/*',
],
'@nolebase/vitepress-plugin-highlight-targeted-heading/*': [
'../packages/vitepress-plugin-highlight-targeted-heading/src/*',
],
'@nolebase/vitepress-plugin-index/*': [
'../packages/vitepress-plugin-index/src/*',
],
'@nolebase/vitepress-plugin-inline-link-preview/*': [
'../packages/vitepress-plugin-inline-link-preview/src/*',
],
'@nolebase/vitepress-plugin-meta/*': [
'../packages/vitepress-plugin-meta/src/*',
],
'@nolebase/vitepress-plugin-git-changelog/*': [
'../packages/vitepress-plugin-git-changelog/src/*',
],
'@nolebase/vitepress-plugin-graph-view/*': [
'../packages/vitepress-plugin-graph-view/src/*',
],
'@nolebase/vitepress-plugin-og-image/*': [
'../packages/vitepress-plugin-og-image/src/*',
],
'@nolebase/vitepress-plugin-page-properties/*': [
'../packages/vitepress-plugin-page-properties/src/*',
],
'@nolebase/vitepress-plugin-sidebar/*': [
'../packages/vitepress-plugin-sidebar/src/*',
],
'@nolebase/vitepress-plugin-thumbnail-hash/*': [
'../packages/vitepress-plugin-thumbnail-hash/src/*',
],
Expand Down
11 changes: 11 additions & 0 deletions docs/data/en/recentUpdates.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createRecentUpdatesLoader } from '@nolebase/vitepress-plugin-index/vitepress'

export default createRecentUpdatesLoader({
dir: 'pages/en',
rewrites: [
{ from: /^pages\/en\//, to: '' },
],
ignores: [
'**/snippets/**.md',
],
})
11 changes: 11 additions & 0 deletions docs/data/zh-CN/recentUpdates.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createRecentUpdatesLoader } from '@nolebase/vitepress-plugin-index/vitepress'

export default createRecentUpdatesLoader({
dir: 'pages/zh-CN',
rewrites: [
{ from: /^pages\/zh-CN\//, to: '' },
],
ignores: [
'**/snippets/**.md',
],
})
9 changes: 6 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
"@nolebase/vitepress-plugin-git-changelog": "workspace:^",
"@nolebase/vitepress-plugin-graph-view": "workspace:^",
"@nolebase/vitepress-plugin-highlight-targeted-heading": "workspace:^",
"@nolebase/vitepress-plugin-index": "workspace:^",
"@nolebase/vitepress-plugin-inline-link-preview": "workspace:^",
"@nolebase/vitepress-plugin-meta": "workspace:^",
"@nolebase/vitepress-plugin-og-image": "workspace:^",
"@nolebase/vitepress-plugin-page-properties": "workspace:^",
"@nolebase/vitepress-plugin-sidebar": "workspace:^",
"@nolebase/vitepress-plugin-thumbnail-hash": "workspace:^",
"@rive-app/canvas": "^2.22.0",
"@rive-app/canvas": "^2.23.4",
"@rollup/plugin-yaml": "^4.1.2",
"@shikijs/vitepress-twoslash": "^1.22.2",
"@types/markdown-it": "^14.1.2",
Expand All @@ -45,7 +47,8 @@
"markdown-it-footnote": "^4.0.0",
"motion": "^10.18.0",
"thumbhash": "^0.1.1",
"unlazy": "^0.11.3",
"vite-plugin-vue-devtools": "^7.6.1"
"typescript": "^5.6.3",
"unlazy": "^0.11.4",
"vite-plugin-vue-devtools": "^7.6.3"
}
}
5 changes: 5 additions & 0 deletions docs/pages/en/guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Getting Started
category: Index
---

# Getting Started

::: warning 🚧 Constructing
Expand Down
3 changes: 3 additions & 0 deletions docs/pages/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ features:
- icon: <span class="rive-canvas" data-rive-canvas="true" data-rive-src="/icons/rocket-emoji-animated.riv"></span>
title: Writing First
details: From the perspective of documentation engineering, solve and simplify some UX/DX problems, aiming to let creators focus on writing documents, notes, making cards and GTD!

nolebase:
index: false
---

<script setup>
Expand Down
5 changes: 5 additions & 0 deletions docs/pages/en/integrations/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Integrations
category: Index
---

<script setup>
import sidebarPackageJSON from '~/packages/vitepress-plugin-sidebar/package.json'
import biDirectionalLinksPackageJSON from '~/packages/markdown-it-bi-directional-links/package.json'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Bi-directional Links
category: Bi-directional Links
---

# Bi-directional Links Example Page

Hi! This is a linked internal page.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Bi-directional Links
category: Bi-directional Links
---

# Bi-directional Links Example Same Name Page

Hi! This is a linked internal page.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Bi-directional Links
category: Bi-directional Links
---

# Getting started

## Installation
Expand Down Expand Up @@ -32,7 +37,7 @@ In the VitePress configuration file (usually `docs/.vitepress/config.ts`, the fi

<!--@include: @/pages/en/snippets/details-colored-diff.md-->

```typescript twoslash
```typescript
import { defineConfigWithTheme } from 'vitepress'
import { BiDirectionalLinks } from '@nolebase/markdown-it-bi-directional-links' // [!code ++]
Expand All @@ -57,14 +62,14 @@ export default defineConfigWithTheme({

Import this plugin into the file where you can access the [`markdown-it`](https://github.com/markdown-it/markdown-it) instance, and use it as a `markdown-it` plugin:

```typescript twoslash
```typescript
import { BiDirectionalLinks } from '@nolebase/markdown-it-bi-directional-links' // [!code ++]
```
Then you need to use the `use()` member methods from the `markdown-it` instance to use this plugin.
With a options object that contains a `dir` field which is the root directory of your project supplied, the value for `dir` field can be obtained through `cwd()` function call that imported from either `process` or `node:process`:
```typescript twoslash
```typescript
import MarkdownIt from 'markdown-it'
let markdownIt: MarkdownIt = null as unknown as MarkdownIt
// ---cut---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Bi-directional Links
category: Bi-directional Links
---

<script setup>
import packageJSON from '~/packages/markdown-it-bi-directional-links/package.json'
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Bi-directional Links
category: Bi-directional Links
---

# Bi-directional Links Example Same Name Page

Hi! This is a linked internal page.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Bi-directional Links
category: Bi-directional Links
---

# Syntax

The following syntaxes are supported:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Elements Transformation
category: Elements Transformation
---

<script setup>
import packageJSON from '~/packages/markdown-it-element-transform/package.json'
</script>
Expand Down Expand Up @@ -60,7 +65,7 @@ Check out install instructions in the [`vite-plugin-inspect` docs](https://githu

This is the living example code where we use it as references:

```ts twoslash
```ts
import MarkdownIt from 'markdown-it'
let markdownIt: MarkdownIt = null as unknown as MarkdownIt
// ---cut---
Expand Down Expand Up @@ -114,7 +119,7 @@ For example:

#### Add `target="_blank"` and `rel="noopener noreferrer"` to links

```ts twoslash
```ts
import MarkdownIt from 'markdown-it'
let markdownIt: MarkdownIt = null as unknown as MarkdownIt
// ---cut---
Expand All @@ -134,7 +139,7 @@ markdownIt.use(ElementTransform, (() => {

#### Add inline styles to the elements

```ts twoslash
```ts
import MarkdownIt from 'markdown-it'
let markdownIt: MarkdownIt = null as unknown as MarkdownIt
// ---cut---
Expand All @@ -153,7 +158,7 @@ markdownIt.use(ElementTransform, (() => {

#### Add more classes to the elements

```ts twoslash
```ts
import MarkdownIt from 'markdown-it'
let markdownIt: MarkdownIt = null as unknown as MarkdownIt
// ---cut---
Expand Down
11 changes: 8 additions & 3 deletions docs/pages/en/integrations/markdown-it-unlazy-img/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Lazy loading blurred thumbnails
category: Lazy loading blurred thumbnails
---

<script setup>
import packageJSON from '~/packages/markdown-it-unlazy-img/package.json'
</script>
Expand Down Expand Up @@ -38,7 +43,7 @@ In the VitePress configuration file (usually `docs/.vitepress/config.ts`, the fi

<!--@include: @/pages/en/snippets/details-colored-diff.md-->

```typescript twoslash
```typescript
import { defineConfigWithTheme } from 'vitepress'
import { UnlazyImages } from '@nolebase/markdown-it-unlazy-img' // [!code ++]
Expand All @@ -65,13 +70,13 @@ export default defineConfigWithTheme({
Import this plugin into the file where you can access the [`markdown-it`](https://github.com/markdown-it/markdown-it) instance, and use it as a `markdown-it` plugin:
```typescript twoslash
```typescript
import { UnlazyImages } from '@nolebase/markdown-it-unlazy-img' // [!code ++]
```
Then you need to use the `use()` member methods from the `markdown-it` instance to use this plugin:
```typescript twoslash
```typescript
import MarkdownIt from 'markdown-it'
let markdownIt: MarkdownIt = null as unknown as MarkdownIt
// ---cut---
Expand Down
5 changes: 5 additions & 0 deletions docs/pages/en/integrations/obsidian-plugin-unocss/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: UnoCSS Plugin
category: UnoCSS Plugin
---

# UnoCSS Plugin <Badge type="warning" text="Beta" />

When crafting documentation in [Nólëbase](https://github.com/nolebase/nolebase), creating numerous visual components is crucial for enhancing the documents with dynamic and interactive user interfaces. This not only makes the content more digestible but also more engaging.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Enhanced <mark>
category: Enhanced <mark>
---

<script setup>
import packageJSON from '~/packages/vitepress-plugin-enhanced-mark/package.json'
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Enhanced Readabilities
category: Enhanced Readabilities
---

<script setup>
import packageJSON from '~/packages/vitepress-plugin-enhanced-readabilities/package.json'
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Git-based page histories
category: Git-based page histories
---

# Configuration

::: danger Deprecating the `mapAuthors` field for UI component options
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Git-based page histories
category: Git-based page histories
---

# Configure Vite plugins

::: danger Deprecating the `locales` field of `GitChangelogMarkdownSection` plugin options
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Git-based page histories
category: Git-based page histories
---

# Getting started

## Installation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Git-based page histories
category: Git-based page histories
---

<script setup>
import packageJSON from '~/packages/vitepress-plugin-git-changelog/package.json'
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Blinking highlight targeted heading
category: Blinking highlight targeted heading
---

<script setup>
import packageJSON from '~/packages/vitepress-plugin-highlight-targeted-heading/package.json'
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Inline Links Previewing
category: Inline Links Previewing
---

# Configuration

The Inline Links Previewing plugin currently provides configuration options related to **Internationalization** and **Popup**.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Inline Links Previewing
category: Inline Links Previewing
---

# Getting Started

## Installation
Expand Down
Loading

0 comments on commit a77cb30

Please sign in to comment.