Skip to content

Commit bf84fa9

Browse files
authored
Merge pull request #53 from anycable/feat/vitepress
Migrate to Vitepress
2 parents 7429f95 + 4d51e73 commit bf84fa9

82 files changed

Lines changed: 9643 additions & 537 deletions

Some content is hidden

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

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Deploy VitePress site to Pages
22
on:
3-
# push:
4-
# branches: [master]
3+
push:
4+
branches: [master]
55
workflow_dispatch:
66

77
permissions:

.github/workflows/trieve.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/.trieve.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/.vitepress/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cache/
2+
dist/
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import MarkdownIt from 'markdown-it'
2+
3+
export interface AvailableSinceParams {
4+
version?: string
5+
description?: string
6+
}
7+
8+
function parseAvailableSinceParams(info: string): AvailableSinceParams {
9+
const basicMatch = info.trim().match(/^available_since(?:\s+(.*))?$/)
10+
if (!basicMatch) return {}
11+
12+
const allParams = basicMatch[1] || ''
13+
const params: AvailableSinceParams = {}
14+
15+
const keyValueMatches = [
16+
...allParams.matchAll(/([a-z]+)(?:=("[^"]*"|[^\s"]+))?/g),
17+
]
18+
for (const [, key, value] of keyValueMatches) {
19+
let cleanValue = value ? value.replace(/^"|"$/g, '') : true
20+
21+
if (key === 'version') params.version = cleanValue as string
22+
if (key === 'description') params.description = cleanValue as string
23+
}
24+
25+
return params
26+
}
27+
28+
export function availableSinceMarkdownPlugin(md: MarkdownIt) {
29+
md.block.ruler.before(
30+
'paragraph',
31+
'available_since_oneliner',
32+
(state, start, end, silent) => {
33+
const line = state.getLines(start, start + 1, 0, false).trim()
34+
35+
const match = line.match(/^@available_since\s+(.+)$/)
36+
if (!match) return false
37+
38+
if (silent) return true
39+
40+
const params = parseAvailableSinceParams(`available_since ${match[1]}`)
41+
const token = state.push('available_since_oneliner', '', 0)
42+
43+
token.content = renderAvailableSince(params, md)
44+
token.map = [start, start + 1]
45+
46+
state.line = start + 1
47+
return true
48+
},
49+
)
50+
51+
md.renderer.rules.available_since_oneliner = (tokens, idx) => {
52+
return tokens[idx].content + '\n'
53+
}
54+
}
55+
56+
function renderAvailableSince(
57+
params: AvailableSinceParams,
58+
md: MarkdownIt,
59+
): string {
60+
const versionAttr = params.version
61+
? `version="${md.utils.escapeHtml(params.version)}"`
62+
: ''
63+
const descriptionAttr = params.description
64+
? `description="${md.utils.escapeHtml(params.description)}"`
65+
: ''
66+
67+
return `<AvailableSince ${versionAttr} ${descriptionAttr} />`
68+
}

docs/.vitepress/config.mts

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
import { defineConfig } from 'vitepress'
2+
import llmstxt from 'vitepress-plugin-llms'
3+
import { availableSinceMarkdownPlugin } from './availableSinceMarkdownPlugin'
4+
5+
export default defineConfig({
6+
title: "AnyCable",
7+
description: "A real-time server for Rails, Laravel, Node.js, and Hotwire applications",
8+
9+
cleanUrls: true,
10+
ignoreDeadLinks: true,
11+
12+
vite: {
13+
plugins: [
14+
llmstxt(),
15+
],
16+
},
17+
18+
markdown: {
19+
config(md) {
20+
md.use(availableSinceMarkdownPlugin)
21+
},
22+
},
23+
24+
head: [
25+
['link', { rel: 'icon', href: '/assets/images/favicon-32x32.png', type: 'image/png', sizes: '32x32' }],
26+
['link', { rel: 'icon', href: '/assets/images/favicon-16x16.png', type: 'image/png', sizes: '16x16' }],
27+
['link', { rel: 'apple-touch-icon', href: '/assets/images/apple-touch-icon.png' }],
28+
['meta', { name: 'theme-color', content: '#ff5e5e' }],
29+
['meta', { property: 'og:title', content: 'AnyCable Documentation' }],
30+
['meta', { property: 'og:description', content: 'A real-time server for Rails, Laravel, Node.js, and Hotwire applications' }],
31+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
32+
['meta', { name: 'twitter:site', content: '@any_cable' }],
33+
['meta', { name: 'keywords', content: 'ruby, rails, websockets, real-time, action-cable, anycable, hotwire, laravel' }],
34+
],
35+
36+
themeConfig: {
37+
logo: {
38+
light: '/assets/images/logo.svg',
39+
dark: '/assets/images/logo_invert.svg',
40+
},
41+
42+
nav: [
43+
{ text: 'Guide', link: '/getting_started', activeMatch: '/' },
44+
{ text: 'anycable.io', link: 'https://anycable.io' },
45+
{ text: 'LLMs', link: '/llms-full.txt' },
46+
],
47+
48+
sidebar: [
49+
{
50+
text: 'Guides',
51+
items: [
52+
{ text: 'Getting started', link: '/getting_started' },
53+
{ text: 'Using with Rails', link: '/rails/getting_started' },
54+
{ text: 'Client-side usage', link: '/guides/client-side' },
55+
{ text: 'Using with JavaScript (serverless)', link: '/guides/serverless' },
56+
{ text: 'Using with Hotwire', link: '/guides/hotwire' },
57+
{ text: 'Using with Laravel', link: '/guides/laravel' },
58+
{ text: 'Broadcasting', link: '/anycable-go/broadcasting' },
59+
{ text: 'Signed streams', link: '/anycable-go/signed_streams' },
60+
{ text: 'Reliable streams', link: '/anycable-go/reliable_streams' },
61+
{ text: 'Presence', link: '/anycable-go/presence' },
62+
{ text: 'REST API', link: '/anycable-go/api' },
63+
{ text: 'JWT authentication', link: '/anycable-go/jwt_identification' },
64+
{ text: '🔥 Troubleshooting', link: '/troubleshooting' },
65+
]
66+
},
67+
{
68+
text: 'AnyCable PRO',
69+
items: [
70+
{ text: 'Going PRO', link: '/pro' },
71+
{ text: 'Install PRO', link: '/pro/install' },
72+
{ text: 'AnyCable RPC', link: '/anycable-go/rpc' },
73+
{ text: 'Apollo GraphQL', link: '/anycable-go/apollo' },
74+
{ text: 'Binary formats', link: '/anycable-go/binary_formats' },
75+
{ text: 'Long polling', link: '/anycable-go/long_polling' },
76+
{ text: 'OCPP support', link: '/anycable-go/ocpp' },
77+
]
78+
},
79+
{
80+
text: 'Protocols',
81+
items: [
82+
{ text: 'Server-sent events', link: '/anycable-go/sse' },
83+
{ text: 'Pusher', link: '/anycable-go/pusher' },
84+
{ text: 'Durable Streams', link: '/anycable-go/durable_streams' },
85+
{ text: 'Long polling', link: '/anycable-go/long_polling' },
86+
{ text: 'OCPP support', link: '/anycable-go/ocpp' },
87+
]
88+
},
89+
{
90+
text: 'Deployment',
91+
items: [
92+
{ text: 'Heroku', link: '/deployment/heroku' },
93+
{ text: 'Fly.io', link: '/deployment/fly' },
94+
{ text: 'Kamal', link: '/deployment/kamal' },
95+
{ text: 'Thruster', link: 'https://github.com/anycable/thruster' },
96+
{ text: 'Render', link: '/deployment/render' },
97+
{ text: 'Hatchbox', link: 'https://hatchbox.relationkit.io/articles/12-does-hatchbox-support-anycable' },
98+
{ text: 'Docker', link: '/deployment/docker' },
99+
{ text: 'Kubernetes', link: '/deployment/kubernetes' },
100+
{ text: 'Capistrano', link: '/deployment/capistrano' },
101+
{ text: 'Systemd', link: '/deployment/systemd' },
102+
{ text: 'AWS Beanstalk', link: 'https://jetrockets.com/blog/scaling-rails-docker-aws-beanstalk' },
103+
{ text: 'AWS ECS', link: 'https://medium.com/expsoftwareengineering/deploying-ruby-on-rails-with-anycable-using-docker-ecs-80f0da2051ba' },
104+
{ text: 'Load Balancing', link: '/deployment/load_balancing' },
105+
{ text: 'Load Testing', link: '/deployment/load_testing' },
106+
]
107+
},
108+
{
109+
text: 'Ruby / Rails',
110+
items: [
111+
{ text: 'Non-Rails usage', link: '/ruby/non_rails' },
112+
{ text: 'CLI', link: '/ruby/cli' },
113+
{ text: 'Configuration', link: '/ruby/configuration' },
114+
{ text: 'HTTP RPC', link: '/ruby/http_rpc' },
115+
{ text: 'Rails extensions', link: '/rails/extensions' },
116+
{ text: 'Authentication', link: '/rails/authentication' },
117+
{ text: 'Channels state', link: '/rails/channels_state' },
118+
{ text: 'gRPC middlewares', link: '/ruby/middlewares' },
119+
{ text: 'Health checking', link: '/ruby/health_checking' },
120+
{ text: 'Logging', link: '/ruby/logging' },
121+
{ text: 'Exceptions handling', link: '/ruby/exceptions' },
122+
{ text: 'Instrumentation via Yabeda', link: 'https://github.com/yabeda-rb/yabeda-anycable' },
123+
{ text: 'Action Cable compatibility', link: '/rails/compatibility' },
124+
{ text: 'Broadcast adapters', link: '/ruby/broadcast_adapters' },
125+
]
126+
},
127+
{
128+
text: 'AnyCable-Go',
129+
items: [
130+
{ text: 'Configuration', link: '/anycable-go/configuration' },
131+
{ text: 'AnyCable RPC', link: '/anycable-go/rpc' },
132+
{ text: 'Broker deep dive', link: '/anycable-go/broker' },
133+
{ text: 'Pub/sub (node-node)', link: '/anycable-go/pubsub' },
134+
{ text: 'Instrumentation', link: '/anycable-go/instrumentation' },
135+
{ text: 'Health checking', link: '/anycable-go/health_checking' },
136+
{ text: 'Tracing', link: '/anycable-go/tracing' },
137+
{ text: 'OS Tuning', link: '/anycable-go/os_tuning' },
138+
{ text: 'Signed streams', link: '/anycable-go/signed_streams' },
139+
{ text: 'Embedded NATS', link: '/anycable-go/embedded_nats' },
140+
{ text: 'Using as a library', link: '/anycable-go/library' },
141+
{ text: 'Telemetry', link: '/anycable-go/telemetry' },
142+
]
143+
},
144+
{
145+
text: 'JavaScript',
146+
items: [
147+
{ text: 'AnyCable Client SDK', link: 'https://github.com/anycable/anycable-client' },
148+
{ text: 'AnyCable Serverless', link: 'https://github.com/anycable/anycable-serverless-js' },
149+
]
150+
},
151+
{
152+
text: 'Misc',
153+
items: [
154+
{ text: 'Benchmarks', link: '/benchmarks' },
155+
{ text: 'Action Cable protocols', link: '/misc/action_cable_protocol' },
156+
{ text: 'Protobuf definitions', link: '/misc/rpc_proto' },
157+
{ text: 'AnyCable server spec', link: '/misc/how_to_anycable_server' },
158+
]
159+
},
160+
{
161+
text: 'Upgrade Notes',
162+
items: [
163+
{ text: 'Release Notes', link: '/release_notes' },
164+
{ text: 'From v1.4.x to v1.5.0', link: '/upgrade-notes/1_4_0_to_1_5_0' },
165+
{ text: 'From v1.3.x to v1.4.0', link: '/upgrade-notes/1_3_0_to_1_4_0' },
166+
{ text: 'From v1.2.x to v1.3.0', link: '/upgrade-notes/1_2_0_to_1_3_0' },
167+
{ text: 'From v1.0.x to v1.1.0', link: '/upgrade-notes/1_0_0_to_1_1_0' },
168+
]
169+
},
170+
],
171+
172+
socialLinks: [
173+
{ icon: 'github', link: 'https://github.com/anycable/anycable' },
174+
{ icon: 'x', link: 'https://twitter.com/any_cable' },
175+
],
176+
177+
search: {
178+
provider: 'local'
179+
},
180+
181+
editLink: {
182+
pattern: 'https://github.com/anycable/docs.anycable.io/edit/master/docs/:path'
183+
},
184+
}
185+
})

0 commit comments

Comments
 (0)