Skip to content

update proxy guide

update proxy guide #4

Workflow file for this run

name: Build Docs Preview & Deploy to Pages
on:
push:
branches: [feat/node-proxy-preview]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Preprocess GitBook tags to HTML
run: |
# Convert GitBook-specific template tags to HTML equivalents
find docs -name '*.md' -type f | while read -r file; do
python3 - "$file" << 'PYEOF'
import re, sys
f = sys.argv[1]
with open(f, 'r') as fh:
text = fh.read()
# {% hint style="..." %} ... {% endhint %}
text = re.sub(
r'\{%\s*hint\s+style="(\w+)"\s*%\}',
r'> **\1:**',
text
)
text = re.sub(r'\{%\s*endhint\s*%\}', '', text)
# {% code title="..." %} ... {% endcode %}
text = re.sub(r'\{%\s*code\s+title="([^"]+)"\s*%\}', r'**\1**', text)
text = re.sub(r'\{%\s*endcode\s*%\}', '', text)
# {% tabs %} {% tab title="..." %} ... {% endtab %} {% endtabs %}
text = re.sub(r'\{%\s*tabs\s*%\}', '', text)
text = re.sub(r'\{%\s*endtabs\s*%\}', '', text)
text = re.sub(r'\{%\s*tab\s+title="([^"]+)"\s*%\}', r'#### \1', text)
text = re.sub(r'\{%\s*endtab\s*%\}', '', text)
# {% stepper %} {% step %} ... {% endstep %} {% endstepper %}
text = re.sub(r'\{%\s*stepper\s*%\}', '', text)
text = re.sub(r'\{%\s*endstepper\s*%\}', '', text)
text = re.sub(r'\{%\s*step\s*%\}', '---\n**Step:**', text)
text = re.sub(r'\{%\s*endstep\s*%\}', '', text)
# {% embed url="..." %} -> markdown link
text = re.sub(r'\{%\s*embed\s+url="([^"]+)"\s*%\}', r'[\1](\1)', text)
# {% file src="..." %} -> markdown link
text = re.sub(r'\{%\s*file\s+src="([^"]+)"[^%]*%\}', r'[Download](\1)', text)
# {% content-ref url="..." %} ... {% endcontent-ref %}
text = re.sub(r'\{%\s*content-ref\s+url="([^"]+)"\s*%\}', r'[\1](\1)', text)
text = re.sub(r'\{%\s*endcontent-ref\s*%\}', '', text)
# Catch any remaining {% ... %} tags
text = re.sub(r'\{%[^%]*%\}', '', text)
with open(f, 'w') as fh:
fh.write(text)
PYEOF
done
- name: Build site with docsify
run: |
mkdir -p _site
SECTIONS="build learn operate press-and-reports reference tutorials"
for section in $SECTIONS; do
mkdir -p _site/$section
cp -r docs/$section/* _site/$section/
# Create docsify index for each section
SUMMARY_FILE="docs/$section/SUMMARY.md"
cat > _site/$section/index.html << HTMLEOF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Stacks Docs - $section</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css">
<style>
.sidebar-nav { font-size: 14px; }
.markdown-section { max-width: 900px; }
</style>
</head>
<body>
<div id="app"></div>
<script>
window.\$docsify = {
name: 'Stacks Docs - $section',
loadSidebar: 'SUMMARY.md',
subMaxLevel: 3,
homepage: 'README.md',
search: 'auto',
auto2top: true
}
</script>
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-toml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-json.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-javascript.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-typescript.min.js"></script>
</body>
</html>
HTMLEOF
done
# Create root index linking to all sections
cat > _site/index.html << 'HTMLEOF'
<!DOCTYPE html>
<html>
<head>
<title>Stacks Docs Preview</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; max-width: 600px; margin: 80px auto; padding: 0 20px; color: #333; }
h1 { border-bottom: 2px solid #5546ff; padding-bottom: 10px; }
a { color: #5546ff; text-decoration: none; }
a:hover { text-decoration: underline; }
li { margin: 10px 0; font-size: 18px; }
.badge { background: #e8e5ff; color: #5546ff; padding: 2px 8px; border-radius: 4px; font-size: 12px; margin-left: 8px; }
</style>
</head>
<body>
<h1>Stacks Docs Preview</h1>
<p>Preview deployment from branch <code>feat/node-proxy-preview</code></p>
<ul>
<li><a href="build/">Build</a></li>
<li><a href="learn/">Learn</a></li>
<li><a href="operate/">Operate</a> <span class="badge">new page</span></li>
<li><a href="press-and-reports/">Press & Reports</a></li>
<li><a href="reference/">Reference</a></li>
<li><a href="tutorials/">Tutorials</a></li>
</ul>
</body>
</html>
HTMLEOF
- uses: actions/upload-pages-artifact@v3
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4