Big Markdown Test
Created: 2024-12-15 01:37:26 | Last updated: 2024-12-18 03:15:32 | Status: Public
SimpleMD Language and Diagram Examples
SVGs
This should be drawn as an SVG image:
This should be code
<svg viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" stroke="black" fill="red"/>
</svg>
Mermaid Diagrams
Sequence Diagram
sequenceDiagram
participant Theo&Auggie
participant Auth
participant API
participant DB
User->>Auth: Login Request
Auth->>DB: Validate Credentials
DB-->>Auth: Validation Result
Auth-->>User: Auth Token
User->>API: Request with Token
API->>DB: Query Data
DB-->>API: Return Data
API-->>User: Response
State Diagram
stateDiagram-v2
[*] --> Idle
Idle --> Processing: Start Job
Processing --> Success: Complete
Processing --> Failed: Error
Success --> [*]
Failed --> Idle: Retry
Flowchart
flowchart TD
A[Start] --> B{Is Session Valid?}
B -->|Yes| C[Load User Data]
B -->|No| D[Redirect to Login]
C --> E[Display Dashboard]
D --> F[Show Login Form]
F --> B
Code Examples
JavaScript
class DocumentManager {
constructor() {
this.documents = new Map();
}
async saveDocument(id, content) {
try {
await this.validateContent(content);
this.documents.set(id, {
content,
lastModified: new Date()
});
return true;
} catch (error) {
console.error(`Failed to save document ${id}:`, error);
return false;
}
}
}
Python
from typing import Optional, List
class DocumentProcessor:
def __init__(self):
self.supported_formats = {'md', 'txt', 'rst'}
def process_document(self, content: str) -> Optional[str]:
"""Process a document and return formatted content."""
if not content:
return None
lines = content.split('\n')
formatted = [self._process_line(line) for line in lines]
return '\n'.join(formatted)
def _process_line(self, line: str) -> str:
return line.strip()
C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Document {
char* content;
size_t length;
char* author;
} Document;
Document* create_document(const char* content, const char* author) {
Document* doc = (Document*)malloc(sizeof(Document));
if (!doc) return NULL;
doc->content = strdup(content);
doc->length = strlen(content);
doc->author = strdup(author);
return doc;
}
Bash
#!/bin/bash
# Backup script for documents
BACKUP_DIR="/var/backups/documents"
DATE=$(date +%Y%m%d)
# Create backup directory
mkdir -p "$BACKUP_DIR/$DATE"
# Copy documents
cp -r /var/www/documents/* "$BACKUP_DIR/$DATE/"
# Compress backup
tar -czf "$BACKUP_DIR/$DATE.tar.gz" "$BACKUP_DIR/$DATE"
# Clean up old backups (keep last 7 days)
find "$BACKUP_DIR" -type d -mtime +7 -exec rm -rf {} \;
PowerShell
# Document management functions
function New-DocumentBackup {
param(
[string]$SourcePath,
[string]$BackupPath
)
$Date = Get-Date -Format "yyyyMMdd"
$BackupDir = Join-Path $BackupPath $Date
try {
New-Item -Path $BackupDir -ItemType Directory -Force
Copy-Item -Path "$SourcePath\*" -Destination $BackupDir -Recurse
Write-Host "Backup completed successfully"
}
catch {
Write-Error "Backup failed: $_"
}
}
CSS
.markdown-content {
--primary-color: #2563eb;
--secondary-color: #475569;
font-family: system-ui, -apple-system, sans-serif;
line-height: 1.6;
max-width: 65ch;
margin: 0 auto;
padding: 2rem;
}
.markdown-content pre {
background-color: #f8fafc;
border-radius: 0.5rem;
padding: 1rem;
overflow-x: auto;
}
.markdown-content table {
border-collapse: collapse;
width: 100%;
}
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document Viewer</title>
</head>
<body>
<main class="document-container">
<article class="markdown-content">
<header>
<h1>Document Title</h1>
<div class="metadata">
<span>Author: John Doe</span>
<span>Created: 2024-12-14</span>
</div>
</header>
<div class="content">
<!-- Document content here -->
</div>
</article>
</main>
</body>
</html>
GDScript (Godot)
extends Node
class_name DocumentProcessor
var supported_formats := ["md", "txt", "rst"]
var current_document: Document
func _ready() -> void:
load_config()
initialize_processor()
func process_document(content: String) -> Dictionary:
var result := {
"success": false,
"content": "",
"errors": []
}
if content.empty():
result.errors.append("Empty document")
return result
result.content = format_content(content)
result.success = true
return result
Plaintext
DOCUMENT STRUCTURE SPECIFICATION
------------------------------
1. Header Section
- Title
- Author
- Creation Date
- Last Modified Date
2. Content Section
- Body Text
- Embedded Images
- Code Blocks
- Tables
3. Metadata Section
- Tags
- Categories
- Version Info
Hex Color Reference
Color Scheme:
Primary Blue: #2563eb
Secondary Gray: #475569
Success Green: #22c55e
Warning Yellow: #eab308
Error Red: #ef4444
Background: #f8fafc
Text Primary: #1e293b
Text Secondary: #64748b
Markdown Table Example
Feature | Status | Description |
---|---|---|
Authentication | ✅ | User login and registration system |
Document Creation | ✅ | Create and edit markdown documents |
Image Upload | ✅ | Support for image uploads in documents |
Code Highlighting | ✅ | Syntax highlighting for code blocks |
Mermaid Diagrams | ✅ | Support for various diagram types |
Public Sharing | ✅ | Option to make documents public |
Version Control | 🚧 | Document versioning (in progress) |
Export Options | 📝 | PDF, HTML export capabilities (planned) |
SQL
-- Document management schema
CREATE TABLE documents (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
author_id INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
is_public BOOLEAN DEFAULT FALSE,
FOREIGN KEY (author_id) REFERENCES users(id)
);
CREATE INDEX idx_documents_author ON documents(author_id);
CREATE INDEX idx_documents_public ON documents(is_public);
Go
package documents
import (
"time"
"errors"
)
type Document struct {
ID int64
Title string
Content string
AuthorID int64
CreatedAt time.Time
UpdatedAt time.Time
IsPublic bool
}
func (d *Document) Validate() error {
if d.Title == "" {
return errors.New("title is required")
}
if len(d.Content) == 0 {
return errors.New("content cannot be empty")
}
if d.AuthorID <= 0 {
return errors.New("invalid author ID")
}
return nil
}
Rust
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
struct Document {
id: u64,
title: String,
content: String,
author_id: u64,
created_at: DateTime<Utc>,
updated_at: DateTime<Utc>,
is_public: bool,
}
impl Document {
pub fn new(title: String, content: String, author_id: u64) -> Self {
let now = Utc::now();
Self {
id: 0, // Will be set by database
title,
content,
author_id,
created_at: now,
updated_at: now,
is_public: false,
}
}
}
YAML
# Document configuration
document:
title: Sample Document
author: John Doe
version: 1.0
settings:
template: default
highlight_style: github
mermaid_theme: default
permissions:
public: false
share_with:
- user1@example.com
- user2@example.com
metadata:
tags:
- documentation
- example
- reference
category: technical
language: en-US