Skip to content

Commit

Permalink
Merge branch 'main' into feat/examples
Browse files Browse the repository at this point in the history
  • Loading branch information
F-loat committed Jul 14, 2024
2 parents c5dfa55 + 85bf8cf commit 8278fbc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 🔂 Surge PR Preview

on: [pull_request]

jobs:
preview:
runs-on: ubuntu-latest
permissions:
pull-requests: write # allow surge-preview to create/update PR comments
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Action
uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: afc163/surge-preview@v1
id: preview_step
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
dist: .vitepress/dist
build: |
pnpm install
pnpm build
- name: Get the preview_url
run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"
5 changes: 3 additions & 2 deletions .vitepress/config/shared.mts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const shared = defineConfig({
const { info, content } = token
token.content = ''
token.hidden = true
const title = info.match(/\[(.*)\]/)?.[1]?.toUpperCase() || ''
const title = info.match(/\[(.*)\]/)?.[1] || ''
return rst + template({ title, content })
}, '')
}
Expand All @@ -137,8 +137,9 @@ export const shared = defineConfig({
render: (tokens, idx) => {
if (tokens[idx].nesting === 1) {
const codeTokens = getTokens(tokens, 'params', idx)
const paramKeys = ['body', 'query', 'path', 'form']
const template = ({ title, content }) => `
["${title}",${content}],
["${title + (paramKeys.includes(title) ? ' params' : '')}",${content}],
`
const dataStr = `[
${getElements(codeTokens, template).trim().replace(/\,$/, '')}
Expand Down
8 changes: 5 additions & 3 deletions .vitepress/theme/components/Api/Params/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="result">
<h3 class="text-xs font-semibold">{{ title }}</h3>
<h3 class="text-xs font-semibold uppercase">{{ title }}</h3>
<div
class="bg-[var(--vp-sidebar-bg-color)] rounded-lg border border-gray-200 dark:border-gray-900 border-solid my-4 px-3"
>
Expand All @@ -13,7 +13,7 @@
})
"
>
<div class="flex justify-between -mt-1">
<div class="flex justify-between">
<div class="flex items-baseline">
<span
v-if="item.required !== false"
Expand All @@ -38,7 +38,9 @@
@change="(val) => handleChange(key, val)"
/>
</div>
<div class="text-xs mt-1">{{ item.description }}</div>
<div v-if="item.description" class="text-xs mt-1">
{{ item.description }}
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/theme/components/Api/Results.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="result">
<h3 class="text-xs font-semibold">{{ title }}</h3>
<h3 class="text-xs font-semibold uppercase">{{ title }}</h3>
<div
class="bg-[var(--vp-sidebar-bg-color)] rounded-lg border border-gray-200 dark:border-gray-900 border-solid my-4"
>
Expand Down

0 comments on commit 8278fbc

Please sign in to comment.