Vai al contenuto

MkDocs Cheatsheet

Traduzione: __HTML_TAG_92_MkDocs - Documentazione di progetto con Markdown

MkDocs è un generatore di sito statico veloce, semplice e diretto che è orientato verso la documentazione di progetto di costruzione. I file sorgente di documentazione sono scritti in Markdown e configurati con un singolo file di configurazione YAML.

Traduzione: Traduzione:

Tavola dei contenuti

Installazione

Python Installation

Traduzione:

Installare MkDocs

Traduzione:

Ambiente virtuale (consigliato)

Traduzione:

Installazione dello sviluppo

Traduzione:

Crea nuovo progetto

Traduzione:

Comandi di base

Traduzione:

Prima documentazione

Traduzione:

# mkdocs.yml
site_name: My Project Documentation
site_description: A comprehensive guide to my project
site_author: Your Name
site_url: https://yourname.github.io/my-project

nav:
  - Home: index.md
  - User Guide: user-guide.md
  - API Reference: api.md

theme:
  name: material

Struttura del progetto

Struttura di base

Traduzione:

Struttura avanzata

Traduzione:

Struttura multilingua

Traduzione:

Configurazione

Configurazione di base

Traduzione:

Configurazione avanzata

Ambiente-specifico Configurazione

Traduzione:

Documentazione di scrittura

Markdown Basics

Traduzione:

Code Blocks

Traduzione: def hello_world(): stampa("Ciao, Mondo!") ```

```python title="example.py" def saluto(nome): ritorna f"Hello, {name}!"

stampa (greet("MkDocs")) Traduzione: def fibonacci(n): se n <= 1: return n return fibonacci(n-1) + fibonacci(n-2) CODE_BLOCK_18__python hl_lines="2 3" def process_data(data): cleaned_data = clean(data) # This line is highlighted result = analyze(cleaned_data) # This line is highlighted return result __CODE_BLOCK_19`

Tables

CODE_BLOCK_20

Admonitions

CODE_BLOCK_21

Content Tabs

CODE_BLOCK_22__python def hello(): print("Hello from Python!") __CODE_BLOCK_23__javascript function hello() { console.log("Hello from JavaScript!"); } __CODE_BLOCK_24__bash echo "Hello from Bash!" __CODE_BLOCK_25

Footnotes

CODE_BLOCK_26

Simple Navigation

CODE_BLOCK_27

Hierarchical Navigation

CODE_BLOCK_28

Auto-generated Navigation

CODE_BLOCK_29

CODE_BLOCK_30

CODE_BLOCK_31

Themes

Material Theme

CODE_BLOCK_32

CODE_BLOCK_33

ReadTheDocs Theme

CODE_BLOCK_34

Custom Theme Configuration

CODE_BLOCK_35

Theme Switching

CODE_BLOCK_36

Plugins

Essential Plugins

CODE_BLOCK_37

Search Plugin

CODE_BLOCK_38

Git Revision Date Plugin

CODE_BLOCK_39

Minify Plugin

CODE_BLOCK_40

Awesome Pages Plugin

CODE_BLOCK_41

Redirects Plugin

CODE_BLOCK_42

Custom Plugin Configuration

CODE_BLOCK_43

Extensions

PyMdown Extensions

CODE_BLOCK_44

CODE_BLOCK_45

Code Highlighting

CODE_BLOCK_46

Math Support

CODE_BLOCK_47

CODE_BLOCK_48

Deployment

GitHub Pages

CODE_BLOCK_49

GitHub Actions

CODE_BLOCK_50

Netlify

CODE_BLOCK_51

Vercel

CODE_BLOCK_52

Docker Deployment

CODE_BLOCK_53

CODE_BLOCK_54

Custom Domain

CODE_BLOCK_55

CODE_BLOCK_56

Custom Themes

Theme Structure

CODE_BLOCK_57

Base Template

CODE_BLOCK_58

Content Template

CODE_BLOCK_59

CODE_BLOCK_60

Advanced Configuration

Multi-site Configuration

CODE_BLOCK_61

Environment Variables

CODE_BLOCK_62

Conditional Configuration

CODE_BLOCK_63

Custom Hooks

CODE_BLOCK_64

CODE_BLOCK_65

Internationalization

Multi-language Setup

CODE_BLOCK_66

Language-specific Content

CODE_BLOCK_67

Translation Structure

CODE_BLOCK_68

Local Search Configuration

CODE_BLOCK_69

External Search Integration

CODE_BLOCK_70

CODE_BLOCK_71

CODE_BLOCK_72

API Documentation

Auto-generated API Docs

CODE_BLOCK_73

CODE_BLOCK_74

CODE_BLOCK_75

OpenAPI Integration

CODE_BLOCK_76

CODE_BLOCK_77

CODE_BLOCK_78

Manual API Documentation

CODE_BLOCK_79__http GET /api/v1/users Authorization: Bearer YOUR_API_KEY __CODE_BLOCK_80__json { "users": [ { "id": 1, "name": "John Doe", "email": "john@example.com" } ], "total": 100, "limit": 10, "offset": 0 } __CODE_BLOCK_81__bash curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.example.com/v1/users?limit=5" __CODE_BLOCK_82

Performance

Build Optimization

CODE_BLOCK_83

Caching Strategy

CODE_BLOCK_84

Image Optimization

CODE_BLOCK_85

CODE_BLOCK_86

Lazy Loading

CODE_BLOCK_87

Best Practices

Content Organization

CODE_BLOCK_88

Writing Best Practices

  • Use clear headings for better navigation
  • Include code examples with proper syntax highlighting
  • Add screenshots for visual guidance
  • Write concise descriptions for better understanding
  • Use consistent formatting across all pages
  • Include cross-references between related topics

SEO Optimization

CODE_BLOCK_89

Maintenance Best Practices

  • Regular updates to keep content current
  • Link checking to prevent broken links
  • Performance monitoring for build times
  • User feedback integration for improvements
  • Version control for documentation changes
  • Automated testing for documentation builds

Summary

MkDocs is a powerful static site generator specifically designed for project documentation. Key features include:

  • Markdown-based: Write documentation in simple Markdown
  • Python-powered: Extensible with Python plugins
  • Theme support: Beautiful themes including Material Design
  • Live preview: Real-time preview during development
  • Easy deployment: Simple deployment to various platforms
  • Plugin ecosystem: Rich ecosystem of plugins for extended functionality
  • Search integration: Built-in search with external search support
  • Multi-language: Support for internationalization

By following best practices and leveraging MkDocs' capabilities, you can create professional, maintainable documentation that serves your users effectively and grows with your project.