How doocs/md works
Main Components
• Frontend Application:
• The core UI lives in the /src directory (with Vue components, entry points, utilities, etc.). This part includes the markdown editor, preview panes, UI components (in subdirectories such as /components and /components/ui), and configuration files (found under /src/config and /src/lib).
• Entry points (like the popup in /src/entrypoints and the background script) support different modes of operation.
• CLI & Local Deployment:
• The md-cli directory contains a Node.js–based command-line interface that users can install globally. This tool allows you to quickly spin up a private version of the editor.
• Docker & Server Components:
• The docker folder includes several Dockerfiles (Dockerfile.base, Dockerfile.nginx, Dockerfile.standalone, Dockerfile.static) and scripts to build images, push images, and release.
• The docker/latest/server/main.go is a Go-based server which may be responsible for handling API requests (for example, file uploads or serving built assets) when deployed in certain environments.
• CI/CD & Configuration:
• The .github/workflows directory (with multiple workflow YAML files) shows the automated build, release, and deployment pipeline for this project.
• Additional configuration files (editorconfig, .nvmrc, .vscode, eslint.config.mjs, postcss.config.js, etc.) help manage coding standards, build scripts, and deployment options.
• External Integrations:
• The README details support for multiple external image-hosting services (GitHub, Aliyun OSS, Tencent Cloud, etc.) along with a customizable upload logic.
• The system thus interacts with these external services for file uploads, which should be represented as external components.
Relationships and Data Flow
• User Interaction:
• The user accesses the application via a web browser (Chrome is recommended) that loads index.html along with the bundled Vue application.
• The application (editor UI) processes Markdown in real time (using utilities in /src/utils and rendering functions) and sends image uploads via API calls.
• Frontend ⇄ Backend Interaction:
• The Vue application might interact with a backend service (provided either by the md-cli Node.js server or the Go-based server run via Docker) via RESTful APIs for operations like file upload and content management.
• CLI / Docker Deployment:
• The md-cli tool acts as an alternative way to launch the service in a local environment.
• CI/CD Pipeline:
• GitHub Actions workflows (build, release, docker builds) that automatically trigger builds and deploys, ensuring a smooth integration/delivery pipeline.
• External Services:
• Components for external image-hosting services, indicating that the editor may send file uploads to third-party APIs based on configured tokens and parameters.
Architectural Patterns and Key Technologies
• Architectural Separation:
• Technologies & Frameworks:
• Frontend: Vue3, Vite, Tailwind (as inferred from tailwind.config.cjs), and various UI libraries/components.
• Backend: Node.js (for md-cli) and Go (in the Docker/server image).
• Build & Deployment: Docker, GitHub Actions, and associated shell scripts (in the /scripts directory).
• Design Principles:
• Modular design (as shown by well-organized directories for components, utilities, stores, and types) and separation of concerns (frontend UI vs backend operations vs deployment configurations).
Essential Elements
• Clear components for each major part:
• “User Browser” (client)
• “Vue3 Editor Application” (frontend that includes real-time markdown processing, custom themes, and rich UI components)
• “md-cli Node.js Server” (local deployment and serving of the editor)
• “Go-based API Server” (part of the Docker deployment for handling API requests)
• “Docker & Build Scripts” (containerized environments with multiple Dockerfiles and build scripts)
• “CI/CD Pipeline” (GitHub Actions build/release workflows)
• “External Image Hosting Services” (multiple third-party integrations for file uploads)
• The flow of user interactions (input, preview, file upload).
• Data flow from the frontend to the backend.
• Automated deployment flows via CI/CD actions.
• Annotations or legends: