|
1 | | -### MarkText website |
| 1 | +# MarkText Website |
| 2 | + |
| 3 | +[](https://reactjs.org/) |
| 4 | +[](https://www.typescriptlang.org/) |
| 5 | +[](https://vitejs.dev/) |
| 6 | + |
| 7 | +The official website for [MarkText](https://github.com/marktext/marktext) - A simple and elegant markdown editor. |
| 8 | + |
| 9 | +## ✨ Features |
| 10 | + |
| 11 | +- 🚀 **Modern Stack**: Built with React 18 + TypeScript + Vite |
| 12 | +- 📝 **Live Preview**: Interactive markdown editor with real-time rendering |
| 13 | +- 🎨 **Multiple Themes**: Support for Dark, Graphite, Material Dark, One Dark, and Ulysses themes |
| 14 | +- 📊 **Diagram Support**: Mermaid diagrams integration for flowcharts, sequence diagrams, and more |
| 15 | +- 🧮 **Math Rendering**: KaTeX support for mathematical formulas |
| 16 | +- 💅 **Syntax Highlighting**: Prism.js integration for code blocks |
| 17 | +- 📱 **Responsive Design**: Works seamlessly on desktop and mobile devices |
| 18 | + |
| 19 | +## 📋 Prerequisites |
| 20 | + |
| 21 | +Before you begin, ensure you have the following installed: |
| 22 | + |
| 23 | +- **Node.js**: >= 16.0.0 (recommended: LTS version) |
| 24 | +- **pnpm**: >= 8.0.0 (recommended package manager) |
| 25 | + |
| 26 | +To install pnpm globally: |
| 27 | + |
| 28 | +```bash |
| 29 | +npm install -g pnpm |
| 30 | +``` |
| 31 | + |
| 32 | +## 🚀 Getting Started |
| 33 | + |
| 34 | +### Installation |
| 35 | + |
| 36 | +1. Clone the repository: |
| 37 | + |
| 38 | +```bash |
| 39 | +git clone https://github.com/marktext/website.git |
| 40 | +cd website |
| 41 | +``` |
| 42 | + |
| 43 | +2. Install dependencies: |
| 44 | + |
| 45 | +```bash |
| 46 | +pnpm install |
| 47 | +``` |
| 48 | + |
| 49 | +### Development |
| 50 | + |
| 51 | +Start the development server with hot-reload: |
| 52 | + |
| 53 | +```bash |
| 54 | +pnpm dev |
| 55 | +``` |
| 56 | + |
| 57 | +The application will be available at `http://localhost:5173` (or the next available port). |
| 58 | + |
| 59 | +### Building for Production |
| 60 | + |
| 61 | +Build the application for production: |
| 62 | + |
| 63 | +```bash |
| 64 | +pnpm build |
| 65 | +``` |
| 66 | + |
| 67 | +The optimized files will be generated in the `build/` directory. |
| 68 | + |
| 69 | +### Preview Production Build |
| 70 | + |
| 71 | +Preview the production build locally: |
| 72 | + |
| 73 | +```bash |
| 74 | +pnpm preview |
| 75 | +``` |
| 76 | + |
| 77 | +### Code Quality |
| 78 | + |
| 79 | +Run TypeScript type checking: |
| 80 | + |
| 81 | +```bash |
| 82 | +pnpm type-check |
| 83 | +``` |
| 84 | + |
| 85 | +Run ESLint to check code quality: |
| 86 | + |
| 87 | +```bash |
| 88 | +pnpm lint |
| 89 | +``` |
| 90 | + |
| 91 | +## 📁 Project Structure |
| 92 | + |
| 93 | +``` |
| 94 | +website/ |
| 95 | +├── src/ |
| 96 | +│ ├── assets/ # Static assets (images, SVGs) |
| 97 | +│ │ └── sponsor/ # Sponsor logos |
| 98 | +│ ├── components/ # React components |
| 99 | +│ │ ├── Feature.tsx # Main feature showcase with markdown preview |
| 100 | +│ │ ├── Footer.tsx # Website footer |
| 101 | +│ │ ├── Sponsor.tsx # Sponsors section |
| 102 | +│ │ ├── Theme.tsx # Theme switcher |
| 103 | +│ │ └── TitleBar.tsx # Navigation bar |
| 104 | +│ ├── markdowns/ # Markdown demo files |
| 105 | +│ ├── muya/ # Muya editor library |
| 106 | +│ ├── themes/ # Theme CSS files |
| 107 | +│ ├── types/ # TypeScript type definitions |
| 108 | +│ ├── utils/ # Utility functions |
| 109 | +│ │ ├── markdownToHtml.ts # Markdown to HTML converter |
| 110 | +│ │ ├── scrollTo.ts # Smooth scrolling utilities |
| 111 | +│ │ ├── theme.ts # Theme management |
| 112 | +│ │ └── themeColor.ts # Theme color definitions |
| 113 | +│ ├── App.tsx # Root component |
| 114 | +│ ├── main.tsx # Application entry point |
| 115 | +│ └── app.global.css # Global styles |
| 116 | +├── public/ # Public static files |
| 117 | +├── build/ # Production build output (generated) |
| 118 | +├── index.html # HTML template |
| 119 | +├── package.json # Project dependencies and scripts |
| 120 | +├── tsconfig.json # TypeScript configuration |
| 121 | +├── vite.config.js # Vite configuration |
| 122 | +└── README.md # This file |
| 123 | +``` |
| 124 | + |
| 125 | +## 🛠️ Tech Stack |
| 126 | + |
| 127 | +### Core |
| 128 | + |
| 129 | +- **React** - UI library |
| 130 | +- **TypeScript** - Type-safe JavaScript |
| 131 | +- **Vite** - Build tool and dev server |
| 132 | + |
| 133 | +### Libraries |
| 134 | + |
| 135 | +- **Mermaid** - Diagram and flowchart rendering |
| 136 | +- **KaTeX** - Math typesetting |
| 137 | +- **Prism.js** - Syntax highlighting |
| 138 | +- **DOMPurify** - HTML sanitization |
| 139 | +- **Axios** - HTTP client |
| 140 | +- **GitHub Markdown CSS** - Markdown styling |
| 141 | + |
| 142 | +### Development Tools |
| 143 | + |
| 144 | +- **ESLint** - Code linting |
| 145 | +- **TypeScript ESLint** - TypeScript-specific linting rules |
| 146 | +- **Vite Plugin SVGR** - SVG to React component conversion |
| 147 | + |
| 148 | +## 🎨 Themes |
| 149 | + |
| 150 | +The website supports multiple editor themes: |
| 151 | + |
| 152 | +- **Cadmium Light** (Default) |
| 153 | +- **Dark** - Dark theme with high contrast |
| 154 | +- **Graphite** - Elegant dark gray theme |
| 155 | +- **Material Dark** - Material Design inspired dark theme |
| 156 | +- **One Dark** - Atom One Dark theme |
| 157 | +- **Ulysses** - Minimalist theme inspired by Ulysses app |
| 158 | + |
| 159 | +## 📝 Markdown Features |
| 160 | + |
| 161 | +The editor preview supports: |
| 162 | + |
| 163 | +- ✅ **CommonMark** and **GitHub Flavored Markdown** |
| 164 | +- ✅ Task lists with checkboxes |
| 165 | +- ✅ Tables with alignment |
| 166 | +- ✅ Code blocks with syntax highlighting |
| 167 | +- ✅ Math equations (inline and block) |
| 168 | +- ✅ Mermaid diagrams |
| 169 | +- ✅ HTML sanitization for security |
| 170 | +- ✅ Auto-linking URLs |
| 171 | +- ✅ Emoji support |
| 172 | + |
| 173 | +## 🔧 Configuration |
| 174 | + |
| 175 | +### Vite Configuration |
| 176 | + |
| 177 | +The `vite.config.js` includes: |
| 178 | + |
| 179 | +- Custom markdown plugin for `.md` file imports |
| 180 | +- SVGR plugin for SVG component generation |
| 181 | +- Optimized build settings |
| 182 | + |
| 183 | +### TypeScript Configuration |
| 184 | + |
| 185 | +Two TypeScript configs are used: |
| 186 | + |
| 187 | +- `tsconfig.json` - App source code configuration |
| 188 | +- `tsconfig.node.json` - Build tools configuration |
| 189 | + |
| 190 | +## 🤝 Contributing |
| 191 | + |
| 192 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 193 | + |
| 194 | +1. Fork the repository |
| 195 | +2. Create your feature branch (`git checkout -b feature/AmazingFeature`) |
| 196 | +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) |
| 197 | +4. Push to the branch (`git push origin feature/AmazingFeature`) |
| 198 | +5. Open a Pull Request |
| 199 | + |
| 200 | +## 📄 License |
| 201 | + |
| 202 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 203 | + |
| 204 | +## 🔗 Links |
| 205 | + |
| 206 | +- **Main Project**: [MarkText Editor](https://github.com/marktext/marktext) |
| 207 | +- **Website**: [https://marktext.me](https://marktext.me) |
| 208 | +- **Documentation**: [MarkText Docs](https://github.com/marktext/marktext/tree/develop/docs) |
| 209 | + |
| 210 | +## 💖 Sponsors |
| 211 | + |
| 212 | +Special thanks to all our sponsors for supporting the MarkText project! |
| 213 | + |
| 214 | +--- |
| 215 | + |
| 216 | +Made with ❤️ by the MarkText Team |
| 217 | + |
0 commit comments