Add client-side LaTeX formula rendering to the Docs Viewer and implement
a parser-safe server-side math stashing mechanism.
Previously, LaTeX math expressions ($ .. $, $$ .. $$) were underdered.
Protecting math blocks with underscore-based placeholders (e.g.,
___MATH_BLOCK_37___) caused Python Markdown to parse the underscores
into emphasis tags, displaying the literal placeholder text (e.g.,
_MATHBLOCK_37_) in the output HTML.
This commit switches the staching mechanism to pure alphanumeric tokens
(e.g., MATHBLOCKTOKEN{index}END), safely bypassing the Markdown parser
before rendering the restored formulas via KaTex
- Integrate KaTeX CSS and auto-render JS in layout.html
- Add server-side math stashing with alphanumeric tokens in main.py
- Mount ./app volume in docker-compose.yml for live code updates
:wa
33 lines
1.0 KiB
YAML
33 lines
1.0 KiB
YAML
services:
|
|
docs:
|
|
build: .
|
|
container_name: ${SERVICE_NAME}
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ${PROJECT_PATH:-./data}:/docs:ro
|
|
- ./app:/app:ro
|
|
environment:
|
|
- DOCS_ROOT=/docs
|
|
- PORT=8000
|
|
networks:
|
|
- proxy
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.${SERVICE_NAME}.rule=Host(`${SERVICE_DOMAIN}`)"
|
|
- "traefik.http.routers.${SERVICE_NAME}.entrypoints=websecure"
|
|
- "traefik.http.routers.${SERVICE_NAME}.tls=true"
|
|
- "traefik.http.routers.${SERVICE_NAME}.service=${SERVICE_NAME}-svc"
|
|
|
|
# HTTP to HTTPS redirect
|
|
- "traefik.http.routers.${SERVICE_NAME}-red.rule=Host(`${SERVICE_DOMAIN}`)"
|
|
- "traefik.http.routers.${SERVICE_NAME}-red.entrypoints=web"
|
|
- "traefik.http.routers.${SERVICE_NAME}-red.middlewares=https-redirect@docker"
|
|
|
|
# Target Port
|
|
- "traefik.http.services.${SERVICE_NAME}-svc.loadbalancer.server.port=8000"
|
|
|
|
networks:
|
|
proxy:
|
|
name: ${PROXY_NETWORK}
|
|
external: true
|