Skip to content

marktext/website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

99 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MarkText Website

Built with React TypeScript Vite

The official website for MarkText - A simple and elegant markdown editor.

โœจ Features

  • ๐Ÿš€ Modern Stack: Built with React 18 + TypeScript + Vite
  • ๐Ÿ“ Live Preview: Interactive markdown editor with real-time rendering
  • ๐ŸŽจ Multiple Themes: Support for Dark, Graphite, Material Dark, One Dark, and Ulysses themes
  • ๐Ÿ“Š Diagram Support: Mermaid diagrams integration for flowcharts, sequence diagrams, and more
  • ๐Ÿงฎ Math Rendering: KaTeX support for mathematical formulas
  • ๐Ÿ’… Syntax Highlighting: Prism.js integration for code blocks
  • ๐Ÿ“ฑ Responsive Design: Works seamlessly on desktop and mobile devices

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js: >= 16.0.0 (recommended: LTS version)
  • pnpm: >= 8.0.0 (recommended package manager)

To install pnpm globally:

npm install -g pnpm

๐Ÿš€ Getting Started

Installation

  1. Clone the repository:
git clone https://github.com/marktext/website.git
cd website
  1. Install dependencies:
pnpm install

Development

Start the development server with hot-reload:

pnpm dev

The application will be available at http://localhost:5173 (or the next available port).

Building for Production

Build the application for production:

pnpm build

The optimized files will be generated in the build/ directory.

Preview Production Build

Preview the production build locally:

pnpm preview

Code Quality

Run TypeScript type checking:

pnpm type-check

Run ESLint to check code quality:

pnpm lint

๐Ÿš€ Deployment

Deploy to GitHub Pages

This project is configured to automatically deploy to GitHub Pages using GitHub Actions.

Setup

  1. Go to your repository Settings โ†’ Pages
  2. Under Source, select GitHub Actions
  3. Push to the master branch or manually trigger the workflow

The site will be available at: https://marktext.github.io/website/

Manual Deployment

You can also trigger the deployment manually:

  1. Go to Actions tab in your GitHub repository
  2. Select Deploy to GitHub Pages workflow
  3. Click Run workflow

Local Preview of Production Build

To preview the production build locally before deploying:

pnpm build
pnpm preview

๐Ÿ“ Project Structure

website/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ assets/          # Static assets (images, SVGs)
โ”‚   โ”‚   โ””โ”€โ”€ sponsor/     # Sponsor logos
โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ Feature.tsx  # Main feature showcase with markdown preview
โ”‚   โ”‚   โ”œโ”€โ”€ Footer.tsx   # Website footer
โ”‚   โ”‚   โ”œโ”€โ”€ Sponsor.tsx  # Sponsors section
โ”‚   โ”‚   โ”œโ”€โ”€ Theme.tsx    # Theme switcher
โ”‚   โ”‚   โ””โ”€โ”€ TitleBar.tsx # Navigation bar
โ”‚   โ”œโ”€โ”€ markdowns/       # Markdown demo files
โ”‚   โ”œโ”€โ”€ muya/            # Muya editor library
โ”‚   โ”œโ”€โ”€ themes/          # Theme CSS files
โ”‚   โ”œโ”€โ”€ types/           # TypeScript type definitions
โ”‚   โ”œโ”€โ”€ utils/           # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ markdownToHtml.ts  # Markdown to HTML converter
โ”‚   โ”‚   โ”œโ”€โ”€ scrollTo.ts        # Smooth scrolling utilities
โ”‚   โ”‚   โ”œโ”€โ”€ theme.ts           # Theme management
โ”‚   โ”‚   โ””โ”€โ”€ themeColor.ts      # Theme color definitions
โ”‚   โ”œโ”€โ”€ App.tsx          # Root component
โ”‚   โ”œโ”€โ”€ main.tsx         # Application entry point
โ”‚   โ””โ”€โ”€ app.global.css   # Global styles
โ”œโ”€โ”€ public/              # Public static files
โ”œโ”€โ”€ build/               # Production build output (generated)
โ”œโ”€โ”€ index.html           # HTML template
โ”œโ”€โ”€ package.json         # Project dependencies and scripts
โ”œโ”€โ”€ tsconfig.json        # TypeScript configuration
โ”œโ”€โ”€ vite.config.js       # Vite configuration
โ””โ”€โ”€ README.md           # This file

๐Ÿ› ๏ธ Tech Stack

Core

  • React - UI library
  • TypeScript - Type-safe JavaScript
  • Vite - Build tool and dev server

Libraries

  • Mermaid - Diagram and flowchart rendering
  • KaTeX - Math typesetting
  • Prism.js - Syntax highlighting
  • DOMPurify - HTML sanitization
  • Axios - HTTP client
  • GitHub Markdown CSS - Markdown styling

Development Tools

  • ESLint - Code linting
  • TypeScript ESLint - TypeScript-specific linting rules
  • Vite Plugin SVGR - SVG to React component conversion

๐ŸŽจ Themes

The website supports multiple editor themes:

  • Cadmium Light (Default)
  • Dark - Dark theme with high contrast
  • Graphite - Elegant dark gray theme
  • Material Dark - Material Design inspired dark theme
  • One Dark - Atom One Dark theme
  • Ulysses - Minimalist theme inspired by Ulysses app

๐Ÿ“ Markdown Features

The editor preview supports:

  • โœ… CommonMark and GitHub Flavored Markdown
  • โœ… Task lists with checkboxes
  • โœ… Tables with alignment
  • โœ… Code blocks with syntax highlighting
  • โœ… Math equations (inline and block)
  • โœ… Mermaid diagrams
  • โœ… HTML sanitization for security
  • โœ… Auto-linking URLs
  • โœ… Emoji support

๐Ÿ”ง Configuration

Vite Configuration

The vite.config.js includes:

  • Custom markdown plugin for .md file imports
  • SVGR plugin for SVG component generation
  • Optimized build settings

TypeScript Configuration

Two TypeScript configs are used:

  • tsconfig.json - App source code configuration
  • tsconfig.node.json - Build tools configuration

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”— Links

๐Ÿ’– Sponsors

Special thanks to all our sponsors for supporting the MarkText project!


Made with โค๏ธ by the MarkText Team

About

The website of MarkText

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 15