Skip to content

Commit 2458451

Browse files
authored
Merge pull request #147 from skryukov/upstream-docs
Upstream docs for v1.3
2 parents f3bcd99 + 2957ff5 commit 2458451

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+10589
-1
lines changed

.github/workflows/docs.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Documentation Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/docs.yml'
10+
pull_request:
11+
paths:
12+
- 'docs/**'
13+
- '.github/workflows/docs.yml'
14+
15+
jobs:
16+
check_formatting:
17+
runs-on: ubuntu-latest
18+
name: Check Documentation Formatting
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '22'
32+
cache: 'npm'
33+
cache-dependency-path: './docs/package-lock.json'
34+
35+
- name: Install dependencies
36+
working-directory: ./docs
37+
run: npm ci
38+
39+
- name: Check formatting
40+
working-directory: ./docs
41+
run: npm run format:check

.github/workflows/push.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
name: Testing
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- 'docs/**'
9+
- '.github/workflows/docs.yml'
10+
- '**.md'
11+
pull_request:
12+
paths-ignore:
13+
- 'docs/**'
14+
- '.github/workflows/docs.yml'
15+
- '**.md'
416

517
jobs:
618
test:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
## Unreleased
7+
8+
### Added
9+
10+
* Inertia Rails documentation (@skryukov)
611

712
## [3.3.0] - 2024-10-27
813

docs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.vitepress/dist
3+
.vitepress/cache

docs/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/node_modules
2+
**/dist
3+
**/cache

docs/.vitepress/config.mts

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import { defineConfig } from 'vitepress'
2+
import { tabsMarkdownPlugin } from './vitepress-plugin-tabs/tabsMarkdownPlugin'
3+
4+
const title = 'Inertia Rails'
5+
const description = 'Documentation for Inertia.js Rails adapter'
6+
const site = 'https://inertia-rails.dev'
7+
const image = `${site}/og_image.jpg`
8+
9+
// https://vitepress.dev/reference/site-config
10+
export default defineConfig({
11+
title,
12+
description,
13+
14+
markdown: {
15+
config(md) {
16+
md.use(tabsMarkdownPlugin)
17+
},
18+
},
19+
20+
head: [
21+
['link', { rel: 'icon', href: '/favicon.ico', sizes: '32x32' }],
22+
['link', { rel: 'icon', href: '/icon.svg', type: 'image/svg+xml' }],
23+
24+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
25+
['meta', { name: 'twitter:site', content: site }],
26+
['meta', { name: 'twitter:description', value: description }],
27+
['meta', { name: 'twitter:image', content: image }],
28+
29+
['meta', { property: 'og:type', content: 'website' }],
30+
['meta', { property: 'og:locale', content: 'en_US' }],
31+
['meta', { property: 'og:site', content: site }],
32+
['meta', { property: 'og:site_name', content: title }],
33+
['meta', { property: 'og:image', content: image }],
34+
['meta', { property: 'og:description', content: description }],
35+
],
36+
themeConfig: {
37+
// https://vitepress.dev/reference/default-theme-config
38+
nav: [
39+
{ text: 'Home', link: '/' },
40+
{ text: 'Guide', link: '/guide' },
41+
{ text: 'Cookbook', link: '/cookbook/integrating-shadcn-ui' },
42+
{
43+
text: 'Links',
44+
items: [
45+
{ text: 'Official Inertia.js docs', link: 'https://inertiajs.com' },
46+
{
47+
text: 'Gems',
48+
items: [
49+
{
50+
text: 'inertia_rails',
51+
link: 'https://github.com/inertiajs/inertia-rails',
52+
},
53+
{
54+
text: 'inertia_rails-contrib',
55+
link: 'https://github.com/skryukov/inertia_rails-contrib',
56+
},
57+
],
58+
},
59+
],
60+
},
61+
],
62+
63+
logo: '/logo.svg',
64+
65+
sidebar: {
66+
'/guide': [
67+
{
68+
items: [
69+
{ text: 'Introduction', link: '/guide' },
70+
{ text: 'Demo app', link: '/guide/demo-application' },
71+
],
72+
},
73+
{
74+
text: 'Installation',
75+
items: [
76+
{ text: 'Server-side', link: '/guide/server-side-setup' },
77+
{ text: 'Client-side', link: '/guide/client-side-setup' },
78+
],
79+
},
80+
{
81+
text: 'Core concepts',
82+
items: [
83+
{ text: 'Who is it for', link: '/guide/who-is-it-for' },
84+
{ text: 'How it works', link: '/guide/how-it-works' },
85+
{ text: 'The protocol', link: '/guide/the-protocol' },
86+
],
87+
},
88+
{
89+
text: 'The basics',
90+
items: [
91+
{ text: 'Pages', link: '/guide/pages' },
92+
{ text: 'Responses', link: '/guide/responses' },
93+
{ text: 'Redirects', link: '/guide/redirects' },
94+
{ text: 'Routing', link: '/guide/routing' },
95+
{ text: 'Title & meta', link: '/guide/title-and-meta' },
96+
{ text: 'Links', link: '/guide/links' },
97+
{ text: 'Manual visits', link: '/guide/manual-visits' },
98+
{ text: 'Forms', link: '/guide/forms' },
99+
{ text: 'File uploads', link: '/guide/file-uploads' },
100+
{ text: 'Validation', link: '/guide/validation' },
101+
{ text: 'Shared data', link: '/guide/shared-data' },
102+
],
103+
},
104+
{
105+
text: 'Advanced',
106+
items: [
107+
{ text: 'Events', link: '/guide/events' },
108+
{ text: 'Testing', link: '/guide/testing' },
109+
{ text: 'Partial reloads', link: '/guide/partial-reloads' },
110+
{ text: 'Scroll management', link: '/guide/scroll-management' },
111+
{ text: 'Authentication', link: '/guide/authentication' },
112+
{ text: 'Authorization', link: '/guide/authorization' },
113+
{ text: 'CSRF protection', link: '/guide/csrf-protection' },
114+
{ text: 'Error handling', link: '/guide/error-handling' },
115+
{ text: 'Asset versioning', link: '/guide/asset-versioning' },
116+
{ text: 'Progress indicators', link: '/guide/progress-indicators' },
117+
{ text: 'Remembering state', link: '/guide/remembering-state' },
118+
{ text: 'Code splitting', link: '/guide/code-splitting' },
119+
{
120+
text: 'Server-side rendering',
121+
link: '/guide/server-side-rendering',
122+
},
123+
],
124+
},
125+
],
126+
'/cookbook': [
127+
{
128+
items: [
129+
{
130+
text: 'Integrations',
131+
items: [
132+
{ text: 'shadcn/ui', link: '/cookbook/integrating-shadcn-ui' },
133+
],
134+
},
135+
],
136+
},
137+
],
138+
},
139+
140+
search: {
141+
provider: 'local',
142+
},
143+
144+
editLink: {
145+
pattern:
146+
'https://github.com/inertiajs/inertia-rails/edit/master/docs/:path',
147+
text: 'Edit this page on GitHub',
148+
},
149+
150+
socialLinks: [
151+
{ icon: 'github', link: 'https://github.com/inertiajs/inertia-rails' },
152+
{ icon: 'x', link: 'https://x.com/inertiajs' },
153+
{ icon: 'discord', link: 'https://discord.gg/inertiajs' },
154+
],
155+
},
156+
})
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const localStorageKey = 'vitepress:tabsSharedState'
2+
const ls = typeof localStorage !== 'undefined' ? localStorage : null
3+
4+
const getLocalStorageValue = (): Record<string, string> => {
5+
const rawValue = ls?.getItem(localStorageKey)
6+
if (rawValue) {
7+
try {
8+
return JSON.parse(rawValue)
9+
} catch {}
10+
}
11+
return {}
12+
}
13+
14+
const setLocalStorageValue = (v: Record<string, string>) => {
15+
if (!ls) return
16+
ls.setItem(localStorageKey, JSON.stringify(v))
17+
}
18+
19+
export const setupFrameworksTabs = () => {
20+
const v = getLocalStorageValue()
21+
if (!v.frameworks) {
22+
setLocalStorageValue({ frameworks: 'React' })
23+
}
24+
}

docs/.vitepress/theme/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import type { Theme } from 'vitepress'
3+
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
4+
import DefaultTheme from 'vitepress/theme'
5+
import { h } from 'vue'
6+
import { setupFrameworksTabs } from './frameworksTabs'
7+
import './style.css'
8+
9+
export default {
10+
extends: DefaultTheme,
11+
Layout: () => {
12+
return h(DefaultTheme.Layout, null, {
13+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
14+
})
15+
},
16+
enhanceApp({ app, router, siteData }) {
17+
enhanceAppWithTabs(app)
18+
},
19+
setup() {
20+
setupFrameworksTabs()
21+
},
22+
} satisfies Theme

0 commit comments

Comments
 (0)