[{"data":1,"prerenderedAt":66},["Reactive",2],{"blog-post-markdown-code-highlighting-syntax-complete-guide":3},{"slug":4,"title":5,"description":6,"excerpt":7,"date":8,"category":9,"author":10,"keywords":11,"readingMinutes":12,"html":13,"headings":14,"tools":40,"related":41},"markdown-code-highlighting-syntax-complete-guide","Markdown Code Highlighting and Syntax Features: Complete Guide for Enhanced Technical Documentation","Master advanced Markdown code highlighting techniques with syntax specification, language detection, custom themes, and interactive code features. Learn professional code presentation for documentation, tutorials, and technical writing.","Advanced Markdown code highlighting transforms technical documentation by providing visually distinct, language-specific syntax coloring and enhanced readability for code examples across…","2025-10-04","Tutorial","Matthew Rathbone","markdown code highlighting, syntax highlighting markdown, code blocks markdown, programming language syntax, markdown code themes, technical documentation, markdown code examples, syntax highlighting themes",24,"\u003Cp>Advanced Markdown code highlighting transforms technical documentation by providing visually distinct, language-specific syntax coloring and enhanced readability for code examples across programming languages and markup formats. By implementing proper syntax specification, custom highlighting themes, and interactive code features, technical writers can create compelling documentation that improves code comprehension while maintaining the simplicity and portability that makes Markdown an ideal format for technical content creation.\u003C/p>\n\u003Ch2 id=\"why-master-code-highlighting-in-markdown\">Why Master Code Highlighting in Markdown?\u003C/h2>\n\u003Cp>Professional code highlighting provides essential benefits for technical documentation:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Cstrong>Enhanced Readability\u003C/strong>: Syntax coloring makes code structure and keywords immediately recognizable\u003C/li>\n\u003Cli>\u003Cstrong>Language Context\u003C/strong>: Proper syntax specification helps readers understand the programming language being demonstrated\u003C/li>\n\u003Cli>\u003Cstrong>Professional Presentation\u003C/strong>: Well-formatted code blocks create polished, publication-ready documentation\u003C/li>\n\u003Cli>\u003Cstrong>Learning Acceleration\u003C/strong>: Visual differentiation of syntax elements speeds comprehension for learners\u003C/li>\n\u003Cli>\u003Cstrong>Cross-Platform Consistency\u003C/strong>: Standardized highlighting works across different Markdown processors and platforms\u003C/li>\n\u003C/ul>\n\u003Ch2 id=\"foundation-code-block-syntax\">Foundation Code Block Syntax\u003C/h2>\n\u003Ch3 id=\"basic-code-block-patterns\">Basic Code Block Patterns\u003C/h3>\n\u003Cp>Understanding the fundamental approaches to creating code blocks in Markdown:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Inline Code Examples\u003C/span>\n\nUse \u003Cspan class=\"hljs-code\">`backticks`\u003C/span> for inline code within sentences. For example, the \u003Cspan class=\"hljs-code\">`console.log()`\u003C/span> function outputs to the browser console.\n\n\u003Cspan class=\"hljs-section\"># Fenced Code Blocks\u003C/span>\n\nUse triple backticks for multi-line code blocks:\n\n\u003Cspan class=\"hljs-code\">```\nfunction greetUser(name) {\n    console.log(&quot;Hello, &quot; + name + &quot;!&quot;);\n}\n\ngreetUser(&quot;World&quot;);\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\"># Indented Code Blocks\u003C/span>\n\nAlternatively, use 4-space indentation:\n\n\u003Cspan class=\"hljs-code\">    def calculate_sum(a, b):\n        return a + b\n    \n    result = calculate_sum(10, 20)\n    print(f&quot;Result: {result}&quot;)\n\u003C/span>\n\u003Cspan class=\"hljs-section\"># Language-Specific Highlighting\u003C/span>\n\nSpecify the programming language after opening backticks:\n\n\u003Cspan class=\"hljs-code\">```javascript\nconst API_URL = &#x27;https://api.example.com&#x27;;\n\nasync function fetchUserData(userId) {\n    try {\n        const response = await fetch(`${API_URL}/users/${userId}`);\n        if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        const userData = await response.json();\n        return userData;\n    } catch (error) {\n        console.error(&#x27;Failed to fetch user data:&#x27;, error);\n        return null;\n    }\n}\n```\u003C/span>\n\n\u003Cspan class=\"hljs-code\">```python\nimport asyncio\nimport aiohttp\nfrom typing import Optional, Dict, Any\n\nclass APIClient:\n    def __init__(self, base_url: str, timeout: int = 30):\n        self.base_url = base_url.rstrip(&#x27;/&#x27;)\n        self.timeout = aiohttp.ClientTimeout(total=timeout)\n        \n    async def get_user(self, user_id: int) -&gt; Optional[Dict[str, Any]]:\n        &quot;&quot;&quot;Fetch user data from the API&quot;&quot;&quot;\n        async with aiohttp.ClientSession(timeout=self.timeout) as session:\n            url = f&quot;{self.base_url}/users/{user_id}&quot;\n            try:\n                async with session.get(url) as response:\n                    response.raise_for_status()\n                    return await response.json()\n            except aiohttp.ClientError as e:\n                print(f&quot;API request failed: {e}&quot;)\n                return None\n\n# Usage example\nasync def main():\n    client = APIClient(&quot;https://api.example.com&quot;)\n    user_data = await client.get_user(123)\n    if user_data:\n        print(f&quot;User: {user_data[&#x27;name&#x27;]}&quot;)\n\nasyncio.run(main())\n```\u003C/span>\n\n\u003Cspan class=\"hljs-code\">```go\npackage main\n\nimport (\n    &quot;context&quot;\n    &quot;encoding/json&quot;\n    &quot;fmt&quot;\n    &quot;net/http&quot;\n    &quot;time&quot;\n)\n\ntype User struct {\n    ID    int    `json:&quot;id&quot;`\n    Name  string `json:&quot;name&quot;`\n    Email string `json:&quot;email&quot;`\n}\n\ntype APIClient struct {\n    baseURL    string\n    httpClient *http.Client\n}\n\nfunc NewAPIClient(baseURL string) *APIClient {\n    return &amp;APIClient{\n        baseURL: baseURL,\n        httpClient: &amp;http.Client{\n            Timeout: 30 * time.Second,\n        },\n    }\n}\n\nfunc (c *APIClient) GetUser(ctx context.Context, userID int) (*User, error) {\n    url := fmt.Sprintf(&quot;%s/users/%d&quot;, c.baseURL, userID)\n    \n    req, err := http.NewRequestWithContext(ctx, &quot;GET&quot;, url, nil)\n    if err != nil {\n        return nil, fmt.Errorf(&quot;creating request: %w&quot;, err)\n    }\n    \n    resp, err := c.httpClient.Do(req)\n    if err != nil {\n        return nil, fmt.Errorf(&quot;making request: %w&quot;, err)\n    }\n    defer resp.Body.Close()\n    \n    if resp.StatusCode != http.StatusOK {\n        return nil, fmt.Errorf(&quot;API error: %s&quot;, resp.Status)\n    }\n    \n    var user User\n    if err := json.NewDecoder(resp.Body).Decode(&amp;user); err != nil {\n        return nil, fmt.Errorf(&quot;decoding response: %w&quot;, err)\n    }\n    \n    return &amp;user, nil\n}\n\nfunc main() {\n    client := NewAPIClient(&quot;https://api.example.com&quot;)\n    \n    ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n    defer cancel()\n    \n    user, err := client.GetUser(ctx, 123)\n    if err != nil {\n        fmt.Printf(&quot;Error: %v\\n&quot;, err)\n        return\n    }\n    \n    fmt.Printf(&quot;User: %s (%s)\\n&quot;, user.Name, user.Email)\n}\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch3 id=\"advanced-language-support\">Advanced Language Support\u003C/h3>\n\u003Cp>Comprehensive syntax highlighting for specialized languages and formats:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Configuration Files\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## YAML Configuration\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\n# Application Configuration\napp:\n  name: &quot;Documentation System&quot;\n  version: &quot;2.1.0&quot;\n  environment: production\n  \ndatabase:\n  host: localhost\n  port: 5432\n  name: docs_db\n  credentials:\n    username: ${DB_USER}\n    password: ${DB_PASS}\n  \ncache:\n  redis:\n    url: &quot;redis://localhost:6379/0&quot;\n    max_connections: 10\n  \nlogging:\n  level: info\n  format: json\n  outputs:\n    - console\n    - file: /var/log/app.log\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## JSON Configuration\u003C/span>\n\u003Cspan class=\"hljs-code\">```json\n{\n  &quot;name&quot;: &quot;markdown-docs&quot;,\n  &quot;version&quot;: &quot;1.0.0&quot;,\n  &quot;description&quot;: &quot;Advanced Markdown documentation system&quot;,\n  &quot;main&quot;: &quot;index.js&quot;,\n  &quot;scripts&quot;: {\n    &quot;start&quot;: &quot;node index.js&quot;,\n    &quot;dev&quot;: &quot;nodemon index.js&quot;,\n    &quot;build&quot;: &quot;webpack --mode production&quot;,\n    &quot;test&quot;: &quot;jest --coverage&quot;\n  },\n  &quot;dependencies&quot;: {\n    &quot;express&quot;: &quot;^4.18.0&quot;,\n    &quot;markdown-it&quot;: &quot;^13.0.0&quot;,\n    &quot;highlight.js&quot;: &quot;^11.7.0&quot;\n  },\n  &quot;devDependencies&quot;: {\n    &quot;nodemon&quot;: &quot;^2.0.0&quot;,\n    &quot;jest&quot;: &quot;^29.0.0&quot;,\n    &quot;webpack&quot;: &quot;^5.70.0&quot;\n  },\n  &quot;engines&quot;: {\n    &quot;node&quot;: &quot;&gt;=16.0.0&quot;,\n    &quot;npm&quot;: &quot;&gt;=8.0.0&quot;\n  }\n}\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## TOML Configuration\u003C/span>\n\u003Cspan class=\"hljs-code\">```toml\n[package]\nname = &quot;markdown-processor&quot;\nversion = &quot;0.1.0&quot;\nedition = &quot;2021&quot;\nauthors = [&quot;Technical Writer &lt;writer@example.com&gt;&quot;]\ndescription = &quot;High-performance Markdown processing library&quot;\n\n[dependencies]\ntokio = { version = &quot;1.0&quot;, features = [&quot;full&quot;] }\nserde = { version = &quot;1.0&quot;, features = [&quot;derive&quot;] }\npulldown-cmark = &quot;0.9&quot;\nsyntect = &quot;5.0&quot;\n\n[dev-dependencies]\ncriterion = &quot;0.4&quot;\ntempfile = &quot;3.0&quot;\n\n[[bin]]\nname = &quot;markdown-cli&quot;\npath = &quot;src/main.rs&quot;\n\n[profile.release]\nopt-level = 3\nlto = true\ncodegen-units = 1\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\"># Database Queries\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## SQL Examples\u003C/span>\n\u003Cspan class=\"hljs-code\">```sql\n-- Complex user analytics query\nWITH user_activity AS (\n    SELECT \n        u.id,\n        u.username,\n        u.email,\n        COUNT(DISTINCT s.id) as session_count,\n        COUNT(DISTINCT p.id) as page_views,\n        MAX(s.created_at) as last_activity,\n        AVG(s.duration) as avg_session_duration\n    FROM users u\n    LEFT JOIN sessions s ON u.id = s.user_id\n    LEFT JOIN page_views p ON s.id = p.session_id\n    WHERE u.created_at &gt;= &#x27;2025-01-01&#x27;\n    GROUP BY u.id, u.username, u.email\n),\nengagement_metrics AS (\n    SELECT \n        id,\n        username,\n        email,\n        session_count,\n        page_views,\n        last_activity,\n        avg_session_duration,\n        CASE \n            WHEN session_count &gt;= 10 AND page_views &gt;= 50 THEN &#x27;High&#x27;\n            WHEN session_count &gt;= 5 AND page_views &gt;= 20 THEN &#x27;Medium&#x27;\n            ELSE &#x27;Low&#x27;\n        END as engagement_level\n    FROM user_activity\n)\nSELECT \n    engagement_level,\n    COUNT(*) as user_count,\n    AVG(session_count) as avg_sessions,\n    AVG(page_views) as avg_page_views,\n    AVG(avg_session_duration) as avg_duration_minutes\nFROM engagement_metrics\nGROUP BY engagement_level\nORDER BY \n    CASE engagement_level\n        WHEN &#x27;High&#x27; THEN 1\n        WHEN &#x27;Medium&#x27; THEN 2\n        WHEN &#x27;Low&#x27; THEN 3\n    END;\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## MongoDB Aggregation\u003C/span>\n\u003Cspan class=\"hljs-code\">```javascript\ndb.users.aggregate([\n    {\n        $match: {\n            created_at: { $gte: new Date(&quot;2025-01-01&quot;) },\n            status: &quot;active&quot;\n        }\n    },\n    {\n        $lookup: {\n            from: &quot;sessions&quot;,\n            localField: &quot;_id&quot;,\n            foreignField: &quot;user_id&quot;,\n            as: &quot;sessions&quot;\n        }\n    },\n    {\n        $lookup: {\n            from: &quot;page_views&quot;,\n            localField: &quot;sessions._id&quot;,\n            foreignField: &quot;session_id&quot;,\n            as: &quot;page_views&quot;\n        }\n    },\n    {\n        $addFields: {\n            session_count: { $size: &quot;$sessions&quot; },\n            total_page_views: { $size: &quot;$page_views&quot; },\n            avg_session_duration: {\n                $avg: &quot;$sessions.duration&quot;\n            },\n            last_activity: {\n                $max: &quot;$sessions.created_at&quot;\n            }\n        }\n    },\n    {\n        $addFields: {\n            engagement_level: {\n                $switch: {\n                    branches: [\n                        {\n                            case: {\n                                $and: [\n                                    { $gte: [&quot;$session_count&quot;, 10] },\n                                    { $gte: [&quot;$total_page_views&quot;, 50] }\n                                ]\n                            },\n                            then: &quot;High&quot;\n                        },\n                        {\n                            case: {\n                                $and: [\n                                    { $gte: [&quot;$session_count&quot;, 5] },\n                                    { $gte: [&quot;$total_page_views&quot;, 20] }\n                                ]\n                            },\n                            then: &quot;Medium&quot;\n                        }\n                    ],\n                    default: &quot;Low&quot;\n                }\n            }\n        }\n    },\n    {\n        $group: {\n            _id: &quot;$engagement_level&quot;,\n            user_count: { $sum: 1 },\n            avg_sessions: { $avg: &quot;$session_count&quot; },\n            avg_page_views: { $avg: &quot;$total_page_views&quot; },\n            avg_duration: { $avg: &quot;$avg_session_duration&quot; }\n        }\n    },\n    {\n        $sort: {\n            _id: 1\n        }\n    }\n]);\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"language-specific-highlighting-techniques\">Language-Specific Highlighting Techniques\u003C/h2>\n\u003Ch3 id=\"custom-syntax-extensions\">Custom Syntax Extensions\u003C/h3>\n\u003Cp>Implementing advanced highlighting for domain-specific languages and frameworks:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Infrastructure as Code\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Terraform Configuration\u003C/span>\n\u003Cspan class=\"hljs-code\">```hcl\n# AWS infrastructure definition\nterraform {\n  required_version = &quot;&gt;= 1.0&quot;\n  required_providers {\n    aws = {\n      source  = &quot;hashicorp/aws&quot;\n      version = &quot;~&gt; 5.0&quot;\n    }\n  }\n  \n  backend &quot;s3&quot; {\n    bucket         = &quot;terraform-state-bucket&quot;\n    key            = &quot;infrastructure/terraform.tfstate&quot;\n    region         = &quot;us-west-2&quot;\n    encrypt        = true\n    dynamodb_table = &quot;terraform-locks&quot;\n  }\n}\n\nprovider &quot;aws&quot; {\n  region = var.aws_region\n  \n  default_tags {\n    tags = {\n      Project     = &quot;Documentation System&quot;\n      Environment = var.environment\n      ManagedBy   = &quot;Terraform&quot;\n    }\n  }\n}\n\n# VPC Configuration\nresource &quot;aws_vpc&quot; &quot;main&quot; {\n  cidr_block           = var.vpc_cidr\n  enable_dns_hostnames = true\n  enable_dns_support   = true\n  \n  tags = {\n    Name = &quot;${var.project_name}-vpc&quot;\n  }\n}\n\nresource &quot;aws_internet_gateway&quot; &quot;main&quot; {\n  vpc_id = aws_vpc.main.id\n  \n  tags = {\n    Name = &quot;${var.project_name}-igw&quot;\n  }\n}\n\n# Public Subnets\nresource &quot;aws_subnet&quot; &quot;public&quot; {\n  count = length(var.availability_zones)\n  \n  vpc_id                  = aws_vpc.main.id\n  cidr_block              = cidrsubnet(var.vpc_cidr, 8, count.index)\n  availability_zone       = var.availability_zones[count.index]\n  map_public_ip_on_launch = true\n  \n  tags = {\n    Name = &quot;${var.project_name}-public-${count.index + 1}&quot;\n    Type = &quot;Public&quot;\n  }\n}\n\n# Application Load Balancer\nresource &quot;aws_lb&quot; &quot;main&quot; {\n  name               = &quot;${var.project_name}-alb&quot;\n  internal           = false\n  load_balancer_type = &quot;application&quot;\n  security_groups    = [aws_security_group.alb.id]\n  subnets            = aws_subnet.public[*].id\n  \n  enable_deletion_protection = var.environment == &quot;production&quot;\n  \n  tags = {\n    Name = &quot;${var.project_name}-alb&quot;\n  }\n}\n\n# ECS Cluster\nresource &quot;aws_ecs_cluster&quot; &quot;main&quot; {\n  name = &quot;${var.project_name}-cluster&quot;\n  \n  configuration {\n    execute_command_configuration {\n      logging = &quot;OVERRIDE&quot;\n      \n      log_configuration {\n        cloud_watch_log_group_name = aws_cloudwatch_log_group.ecs.name\n      }\n    }\n  }\n  \n  setting {\n    name  = &quot;containerInsights&quot;\n    value = &quot;enabled&quot;\n  }\n  \n  tags = {\n    Name = &quot;${var.project_name}-cluster&quot;\n  }\n}\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Docker Compose\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\nversion: &#x27;3.8&#x27;\n\nservices:\n  # Application Service\n  app:\n    build:\n      context: .\n      dockerfile: Dockerfile\n      args:\n        - NODE_ENV=production\n    ports:\n      - &quot;3000:3000&quot;\n    environment:\n      - NODE_ENV=production\n      - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/docs_db\n      - REDIS_URL=redis://redis:6379/0\n      - JWT_SECRET=${JWT_SECRET}\n    depends_on:\n      db:\n        condition: service_healthy\n      redis:\n        condition: service_started\n    volumes:\n      - ./uploads:/app/uploads\n      - ./logs:/app/logs\n    healthcheck:\n      test: [&quot;CMD&quot;, &quot;curl&quot;, &quot;-f&quot;, &quot;http://localhost:3000/health&quot;]\n      interval: 30s\n      timeout: 10s\n      retries: 3\n      start_period: 40s\n    restart: unless-stopped\n    networks:\n      - app-network\n  \n  # Database Service\n  db:\n    image: postgres:15-alpine\n    environment:\n      - POSTGRES_DB=docs_db\n      - POSTGRES_USER=postgres\n      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}\n    volumes:\n      - postgres_data:/var/lib/postgresql/data\n      - ./init-scripts:/docker-entrypoint-initdb.d\n    ports:\n      - &quot;5432:5432&quot;\n    healthcheck:\n      test: [&quot;CMD-SHELL&quot;, &quot;pg_isready -U postgres -d docs_db&quot;]\n      interval: 10s\n      timeout: 5s\n      retries: 5\n    restart: unless-stopped\n    networks:\n      - app-network\n  \n  # Redis Cache Service\n  redis:\n    image: redis:7-alpine\n    command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}\n    ports:\n      - &quot;6379:6379&quot;\n    volumes:\n      - redis_data:/data\n    restart: unless-stopped\n    networks:\n      - app-network\n  \n  # Nginx Reverse Proxy\n  nginx:\n    image: nginx:alpine\n    ports:\n      - &quot;80:80&quot;\n      - &quot;443:443&quot;\n    volumes:\n      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro\n      - ./nginx/ssl:/etc/nginx/ssl:ro\n      - ./static:/var/www/static:ro\n    depends_on:\n      - app\n    restart: unless-stopped\n    networks:\n      - app-network\n  \n  # Monitoring\n  prometheus:\n    image: prom/prometheus:latest\n    ports:\n      - &quot;9090:9090&quot;\n    volumes:\n      - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro\n      - prometheus_data:/prometheus\n    command:\n      - &#x27;--config.file=/etc/prometheus/prometheus.yml&#x27;\n      - &#x27;--storage.tsdb.path=/prometheus&#x27;\n      - &#x27;--web.console.libraries=/etc/prometheus/console_libraries&#x27;\n      - &#x27;--web.console.templates=/etc/prometheus/consoles&#x27;\n      - &#x27;--storage.tsdb.retention.time=200h&#x27;\n      - &#x27;--web.enable-lifecycle&#x27;\n    restart: unless-stopped\n    networks:\n      - app-network\n\nvolumes:\n  postgres_data:\n    driver: local\n  redis_data:\n    driver: local\n  prometheus_data:\n    driver: local\n\nnetworks:\n  app-network:\n    driver: bridge\n    ipam:\n      config:\n        - subnet: 172.20.0.0/16\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\"># Shell Scripts and DevOps\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Bash Deployment Script\u003C/span>\n\u003Cspan class=\"hljs-code\">```bash\n#!/bin/bash\n\n# Advanced deployment script with error handling and rollback\nset -euo pipefail\n\n# Configuration\nSCRIPT_DIR=&quot;$(cd &quot;$(dirname &quot;${BASH_SOURCE[0]}&quot;)&quot; &amp;&amp; pwd)&quot;\nPROJECT_NAME=&quot;${PROJECT_NAME:-docs-system}&quot;\nENVIRONMENT=&quot;${ENVIRONMENT:-staging}&quot;\nBUILD_NUMBER=&quot;${BUILD_NUMBER:-$(date +%Y%m%d-%H%M%S)}&quot;\nDEPLOY_TIMEOUT=&quot;${DEPLOY_TIMEOUT:-300}&quot;\n\n# Color codes for output\nreadonly RED=&#x27;\\033[0;31m&#x27;\nreadonly GREEN=&#x27;\\033[0;32m&#x27;\nreadonly YELLOW=&#x27;\\033[1;33m&#x27;\nreadonly BLUE=&#x27;\\033[0;34m&#x27;\nreadonly NC=&#x27;\\033[0m&#x27; # No Color\n\n# Logging functions\nlog_info() {\n    echo -e &quot;${BLUE}[INFO]${NC} $1&quot; &gt;&amp;2\n}\n\nlog_success() {\n    echo -e &quot;${GREEN}[SUCCESS]${NC} $1&quot; &gt;&amp;2\n}\n\nlog_warning() {\n    echo -e &quot;${YELLOW}[WARNING]${NC} $1&quot; &gt;&amp;2\n}\n\nlog_error() {\n    echo -e &quot;${RED}[ERROR]${NC} $1&quot; &gt;&amp;2\n}\n\n# Error handling\ncleanup_on_error() {\n    local exit_code=$?\n    log_error &quot;Deployment failed with exit code $exit_code&quot;\n    \n    if [[ -n &quot;${PREVIOUS_VERSION:-}&quot; ]]; then\n        log_info &quot;Initiating rollback to previous version: $PREVIOUS_VERSION&quot;\n        rollback_deployment &quot;$PREVIOUS_VERSION&quot;\n    fi\n    \n    exit $exit_code\n}\n\ntrap cleanup_on_error ERR\n\n# Health check function\ncheck_service_health() {\n    local service_url=&quot;$1&quot;\n    local max_attempts=&quot;${2:-30}&quot;\n    local attempt=1\n    \n    log_info &quot;Checking service health at $service_url&quot;\n    \n    while [[ $attempt -le $max_attempts ]]; do\n        if curl -sf --connect-timeout 5 --max-time 10 &quot;$service_url&quot; &gt; /dev/null; then\n            log_success &quot;Service is healthy&quot;\n            return 0\n        fi\n        \n        log_info &quot;Health check attempt $attempt/$max_attempts failed, waiting...&quot;\n        sleep 10\n        ((attempt++))\n    done\n    \n    log_error &quot;Service failed health checks after $max_attempts attempts&quot;\n    return 1\n}\n\n# Deployment function\ndeploy_application() {\n    local version=&quot;$1&quot;\n    \n    log_info &quot;Starting deployment of version $version to $ENVIRONMENT&quot;\n    \n    # Pull latest images\n    log_info &quot;Pulling Docker images...&quot;\n    docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; pull\n    \n    # Run database migrations if needed\n    if [[ -f &quot;migrations/pending.txt&quot; ]]; then\n        log_info &quot;Running database migrations...&quot;\n        docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; run --rm app npm run migrate\n    fi\n    \n    # Deploy with zero-downtime\n    log_info &quot;Deploying services...&quot;\n    docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; up -d --remove-orphans\n    \n    # Wait for services to be ready\n    local health_url=&quot;http://localhost:3000/health&quot;\n    if ! check_service_health &quot;$health_url&quot; 30; then\n        log_error &quot;Application health check failed&quot;\n        return 1\n    fi\n    \n    log_success &quot;Deployment completed successfully&quot;\n}\n\n# Rollback function\nrollback_deployment() {\n    local target_version=&quot;$1&quot;\n    \n    log_warning &quot;Rolling back to version $target_version&quot;\n    \n    # Set image tags to previous version\n    export IMAGE_TAG=&quot;$target_version&quot;\n    \n    # Deploy previous version\n    docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; up -d --remove-orphans\n    \n    # Verify rollback\n    local health_url=&quot;http://localhost:3000/health&quot;\n    if check_service_health &quot;$health_url&quot; 15; then\n        log_success &quot;Rollback completed successfully&quot;\n    else\n        log_error &quot;Rollback failed - manual intervention required&quot;\n        exit 1\n    fi\n}\n\n# Pre-deployment checks\nrun_pre_deployment_checks() {\n    log_info &quot;Running pre-deployment checks...&quot;\n    \n    # Check Docker daemon\n    if ! docker info &gt; /dev/null 2&gt;&amp;1; then\n        log_error &quot;Docker daemon is not running&quot;\n        exit 1\n    fi\n    \n    # Check available disk space (minimum 2GB)\n    local available_space\n    available_space=$(df / | tail -1 | awk &#x27;{print $4}&#x27;)\n    if [[ $available_space -lt 2000000 ]]; then\n        log_warning &quot;Low disk space detected: ${available_space}KB available&quot;\n    fi\n    \n    # Check if services are running\n    if docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; ps | grep -q &quot;Up&quot;; then\n        PREVIOUS_VERSION=$(docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; images | grep app | awk &#x27;{print $2}&#x27; | head -1)\n        log_info &quot;Previous version detected: ${PREVIOUS_VERSION:-unknown}&quot;\n    fi\n    \n    log_success &quot;Pre-deployment checks passed&quot;\n}\n\n# Post-deployment verification\nrun_post_deployment_verification() {\n    log_info &quot;Running post-deployment verification...&quot;\n    \n    # Test critical endpoints\n    local base_url=&quot;http://localhost:3000&quot;\n    local endpoints=(&quot;/health&quot; &quot;/api/status&quot; &quot;/api/version&quot;)\n    \n    for endpoint in &quot;${endpoints[@]}&quot;; do\n        if ! curl -sf --connect-timeout 5 &quot;$base_url$endpoint&quot; &gt; /dev/null; then\n            log_error &quot;Endpoint $endpoint is not responding&quot;\n            return 1\n        fi\n    done\n    \n    # Test database connectivity\n    if ! docker-compose -f &quot;docker-compose.${ENVIRONMENT}.yml&quot; exec -T db pg_isready -U postgres; then\n        log_error &quot;Database connectivity test failed&quot;\n        return 1\n    fi\n    \n    log_success &quot;Post-deployment verification completed&quot;\n}\n\n# Main deployment workflow\nmain() {\n    log_info &quot;Starting deployment workflow for $PROJECT_NAME ($ENVIRONMENT)&quot;\n    log_info &quot;Build number: $BUILD_NUMBER&quot;\n    \n    run_pre_deployment_checks\n    \n    deploy_application &quot;$BUILD_NUMBER&quot;\n    \n    run_post_deployment_verification\n    \n    # Clean up old images\n    log_info &quot;Cleaning up old Docker images...&quot;\n    docker image prune -f\n    \n    log_success &quot;Deployment workflow completed successfully!&quot;\n    log_info &quot;Application is now running version $BUILD_NUMBER&quot;\n}\n\n# Script entry point\nif [[ &quot;${BASH_SOURCE[0]}&quot; == &quot;${0}&quot; ]]; then\n    main &quot;$@&quot;\nfi\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"interactive-code-features\">Interactive Code Features\u003C/h2>\n\u003Ch3 id=\"code-block-enhancements\">Code Block Enhancements\u003C/h3>\n\u003Cp>Advanced techniques for creating interactive and enhanced code presentations:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Enhanced Code Presentations\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Code with Line Numbers and Highlighting\u003C/span>\n\n\u003Cspan class=\"hljs-code\">```javascript {linenos=true,hl_lines=[8,&quot;15-17&quot;],linenostart=1}\n// Advanced API client with retry logic and exponential backoff\nclass ResilientAPIClient {\n    constructor(baseURL, options = {}) {\n        this.baseURL = baseURL;\n        this.maxRetries = options.maxRetries || 3;\n        this.baseDelay = options.baseDelay || 1000;\n        this.maxDelay = options.maxDelay || 30000;\n        this.timeout = options.timeout || 10000; // Highlighted line\n        \n        // Create axios instance with default config\n        this.client = axios.create({\n            baseURL: this.baseURL,\n            timeout: this.timeout,\n            headers: {\n                &#x27;Content-Type&#x27;: &#x27;application/json&#x27;,\n                &#x27;User-Agent&#x27;: &#x27;ResilientAPIClient/1.0.0&#x27; // Highlighted block start\n            }\n        }); // Highlighted block end\n    }\n    \n    async executeWithRetry(requestFn) {\n        let lastError;\n        \n        for (let attempt = 0; attempt &lt;= this.maxRetries; attempt++) {\n            try {\n                const result = await requestFn();\n                return result;\n            } catch (error) {\n                lastError = error;\n                \n                if (attempt === this.maxRetries) {\n                    break;\n                }\n                \n                // Calculate delay with exponential backoff\n                const delay = Math.min(\n                    this.baseDelay * Math.pow(2, attempt),\n                    this.maxDelay\n                );\n                \n                console.log(`Request failed (attempt ${attempt + 1}), retrying in ${delay}ms...`);\n                await this.sleep(delay);\n            }\n        }\n        \n        throw lastError;\n    }\n    \n    sleep(ms) {\n        return new Promise(resolve =&gt; setTimeout(resolve, ms));\n    }\n}\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Tabbed Code Examples\u003C/span>\n\n\n\u003Cspan class=\"hljs-code\">```markdown\n&lt;!-- Tab Group: API Implementation --&gt;\n{% tabs %}\n\n{% tab title=&quot;Node.js&quot; %}\n```\u003C/span>javascript\nconst express = require(&#x27;express&#x27;);\nconst helmet = require(&#x27;helmet&#x27;);\nconst compression = require(&#x27;compression&#x27;);\nconst rateLimit = require(&#x27;express-rate-limit&#x27;);\n\nconst app = express();\n\n// Security middleware\napp.use(helmet({\n\u003Cspan class=\"hljs-code\">    contentSecurityPolicy: {\n        directives: {\n            defaultSrc: [&quot;&#x27;self&#x27;&quot;],\n            styleSrc: [&quot;&#x27;self&#x27;&quot;, &quot;&#x27;unsafe-inline&#x27;&quot;],\n            scriptSrc: [&quot;&#x27;self&#x27;&quot;],\n            imgSrc: [&quot;&#x27;self&#x27;&quot;, &quot;data:&quot;, &quot;https:&quot;],\n        },\n    },\n}));\n\u003C/span>\n// Rate limiting\nconst limiter = rateLimit({\n\u003Cspan class=\"hljs-code\">    windowMs: 15 * 60 * 1000, // 15 minutes\n    max: 100, // limit each IP to 100 requests per windowMs\n    message: {\n        error: &#x27;Too many requests from this IP, please try again later.&#x27;\n    }\n});\n\u003C/span>\napp.use(limiter);\napp.use(compression());\napp.use(express.json({ limit: &#x27;10mb&#x27; }));\n\n// API Routes\napp.get(&#x27;/api/users/:id&#x27;, async (req, res) =&gt; {\n\u003Cspan class=\"hljs-code\">    try {\n        const userId = parseInt(req.params.id);\n        const user = await getUserById(userId);\n        \n        if (!user) {\n            return res.status(404).json({ error: &#x27;User not found&#x27; });\n        }\n        \n        res.json({\n            success: true,\n            data: user\n        });\n    } catch (error) {\n        console.error(&#x27;Error fetching user:&#x27;, error);\n        res.status(500).json({ error: &#x27;Internal server error&#x27; });\n    }\n});\n\u003C/span>\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () =&gt; {\n\u003Cspan class=\"hljs-code\">    console.log(`Server running on port ${PORT}`);\n});\n```\n{% endtab %}\n\u003C/span>\n{% tab title=&quot;Python FastAPI&quot; %}\n\u003Cspan class=\"hljs-code\">```python\nfrom fastapi import FastAPI, HTTPException, Depends, status\nfrom fastapi.middleware.cors import CORSMiddleware\nfrom fastapi.middleware.gzip import GZipMiddleware\nfrom fastapi.security import HTTPBearer, HTTPAuthorizationCredentials\nfrom fastapi_limiter import FastAPILimiter\nfrom fastapi_limiter.depends import RateLimiter\nimport redis.asyncio as redis\nfrom pydantic import BaseModel\nfrom typing import Optional\nimport logging\n\napp = FastAPI(\n    title=&quot;Documentation API&quot;,\n    description=&quot;Advanced API for documentation management&quot;,\n    version=&quot;2.0.0&quot;\n)\n\n# Middleware\napp.add_middleware(GZipMiddleware, minimum_size=1000)\napp.add_middleware(\n    CORSMiddleware,\n    allow_origins=[&quot;https://docs.example.com&quot;],\n    allow_credentials=True,\n    allow_methods=[&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;, &quot;DELETE&quot;],\n    allow_headers=[&quot;*&quot;],\n)\n\n# Security\nsecurity = HTTPBearer()\n\nclass User(BaseModel):\n    id: int\n    name: str\n    email: str\n    is_active: bool = True\n\nclass UserResponse(BaseModel):\n    success: bool\n    data: User\n\n@app.on_event(&quot;startup&quot;)\nasync def startup():\n    redis_client = redis.from_url(&quot;redis://localhost&quot;, encoding=&quot;utf-8&quot;, decode_responses=True)\n    await FastAPILimiter.init(redis_client)\n\nasync def verify_token(credentials: HTTPAuthorizationCredentials = Depends(security)):\n    # Token verification logic here\n    if not credentials.credentials:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=&quot;Invalid authentication credentials&quot;\n        )\n    return credentials.credentials\n\n@app.get(&quot;/api/users/{user_id}&quot;, \n         response_model=UserResponse,\n         dependencies=[Depends(RateLimiter(times=10, seconds=60))])\nasync def get_user(\n    user_id: int,\n    token: str = Depends(verify_token)\n) -&gt; UserResponse:\n    &quot;&quot;&quot;\n    Retrieve user information by ID.\n    \n    - **user_id**: The ID of the user to retrieve\n    - **Returns**: User information with success status\n    &quot;&quot;&quot;\n    try:\n        user = await get_user_by_id(user_id)\n        \n        if not user:\n            raise HTTPException(\n                status_code=status.HTTP_404_NOT_FOUND,\n                detail=&quot;User not found&quot;\n            )\n        \n        return UserResponse(success=True, data=user)\n        \n    except Exception as e:\n        logging.error(f&quot;Error fetching user {user_id}: {str(e)}&quot;)\n        raise HTTPException(\n            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,\n            detail=&quot;Internal server error&quot;\n        )\n\nif __name__ == &quot;__main__&quot;:\n    import uvicorn\n    uvicorn.run(app, host=&quot;0.0.0.0&quot;, port=8000)\n```\u003C/span>\n{% endtab %}\n\n{% tab title=&quot;Go Gin&quot; %}\n\u003Cspan class=\"hljs-code\">```go\npackage main\n\nimport (\n    &quot;context&quot;\n    &quot;fmt&quot;\n    &quot;net/http&quot;\n    &quot;strconv&quot;\n    &quot;time&quot;\n\n    &quot;github.com/gin-contrib/cors&quot;\n    &quot;github.com/gin-contrib/gzip&quot;\n    &quot;github.com/gin-gonic/gin&quot;\n    &quot;github.com/go-redis/redis_rate/v10&quot;\n    &quot;github.com/go-redis/redis/v8&quot;\n    &quot;go.uber.org/zap&quot;\n)\n\ntype User struct {\n    ID       int    `json:&quot;id&quot;`\n    Name     string `json:&quot;name&quot;`\n    Email    string `json:&quot;email&quot;`\n    IsActive bool   `json:&quot;is_active&quot;`\n}\n\ntype UserResponse struct {\n    Success bool `json:&quot;success&quot;`\n    Data    User `json:&quot;data&quot;`\n}\n\ntype APIError struct {\n    Error string `json:&quot;error&quot;`\n}\n\nfunc main() {\n    // Initialize logger\n    logger, _ := zap.NewProduction()\n    defer logger.Sync()\n\n    // Initialize Redis for rate limiting\n    rdb := redis.NewClient(&amp;redis.Options{\n        Addr: &quot;localhost:6379&quot;,\n    })\n    \n    limiter := redis_rate.NewLimiter(rdb)\n\n    // Initialize Gin router\n    router := gin.New()\n    \n    // Middleware\n    router.Use(gin.LoggerWithZap(logger, time.RFC3339, true))\n    router.Use(gin.RecoveryWithZap(logger, true))\n    router.Use(gzip.Gzip(gzip.DefaultCompression))\n    \n    // CORS configuration\n    config := cors.DefaultConfig()\n    config.AllowOrigins = []string{&quot;https://docs.example.com&quot;}\n    config.AllowCredentials = true\n    router.Use(cors.New(config))\n\n    // Rate limiting middleware\n    rateLimitMiddleware := func(c *gin.Context) {\n        ctx := context.Background()\n        key := &quot;rate_limit:&quot; + c.ClientIP()\n        \n        res, err := limiter.Allow(ctx, key, redis_rate.PerMinute(60))\n        if err != nil {\n            logger.Error(&quot;Rate limiting error&quot;, zap.Error(err))\n            c.Next()\n            return\n        }\n        \n        if res.Allowed == 0 {\n            c.JSON(http.StatusTooManyRequests, APIError{\n                Error: &quot;Rate limit exceeded&quot;,\n            })\n            c.Abort()\n            return\n        }\n        \n        c.Next()\n    }\n\n    // Authentication middleware\n    authMiddleware := func(c *gin.Context) {\n        token := c.GetHeader(&quot;Authorization&quot;)\n        if token == &quot;&quot; {\n            c.JSON(http.StatusUnauthorized, APIError{\n                Error: &quot;Authorization header required&quot;,\n            })\n            c.Abort()\n            return\n        }\n        \n        // Token validation logic here\n        // For demo purposes, we&#x27;ll just check if it&#x27;s not empty\n        \n        c.Next()\n    }\n\n    // API Routes\n    api := router.Group(&quot;/api&quot;, rateLimitMiddleware, authMiddleware)\n    {\n        api.GET(&quot;/users/:id&quot;, getUserHandler(logger))\n    }\n\n    // Start server\n    port := &quot;8080&quot;\n    logger.Info(&quot;Starting server&quot;, zap.String(&quot;port&quot;, port))\n    \n    if err := router.Run(&quot;:&quot; + port); err != nil {\n        logger.Fatal(&quot;Failed to start server&quot;, zap.Error(err))\n    }\n}\n\nfunc getUserHandler(logger *zap.Logger) gin.HandlerFunc {\n    return func(c *gin.Context) {\n        userIDStr := c.Param(&quot;id&quot;)\n        userID, err := strconv.Atoi(userIDStr)\n        if err != nil {\n            c.JSON(http.StatusBadRequest, APIError{\n                Error: &quot;Invalid user ID&quot;,\n            })\n            return\n        }\n\n        // Mock user retrieval\n        user, err := getUserByID(userID)\n        if err != nil {\n            logger.Error(&quot;Error fetching user&quot;, \n                zap.Int(&quot;user_id&quot;, userID),\n                zap.Error(err),\n            )\n            c.JSON(http.StatusInternalServerError, APIError{\n                Error: &quot;Internal server error&quot;,\n            })\n            return\n        }\n\n        if user == nil {\n            c.JSON(http.StatusNotFound, APIError{\n                Error: &quot;User not found&quot;,\n            })\n            return\n        }\n\n        c.JSON(http.StatusOK, UserResponse{\n            Success: true,\n            Data:    *user,\n        })\n    }\n}\n\nfunc getUserByID(id int) (*User, error) {\n    // Mock implementation\n    if id == 123 {\n        return &amp;User{\n            ID:       123,\n            Name:     &quot;John Doe&quot;,\n            Email:    &quot;john@example.com&quot;,\n            IsActive: true,\n        }, nil\n    }\n    return nil, nil\n}\n```\u003C/span>\n{% endtab %}\n\n{% endtabs %}\n\u003C/code>\u003C/pre>\u003Ch3 id=\"code-annotation-and-documentation\">Code Annotation and Documentation\u003C/h3>\n\u003Cp>Advanced techniques for creating comprehensive code documentation:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Annotated Code Examples\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Function Documentation with Examples\u003C/span>\n\n\u003Cspan class=\"hljs-code\">```python\ndef process_markdown_with_highlighting(\n    content: str,\n    language: str = &quot;markdown&quot;,\n    theme: str = &quot;default&quot;,\n    line_numbers: bool = True,\n    highlight_lines: Optional[List[int]] = None\n) -&gt; Dict[str, Any]:\n    &quot;&quot;&quot;\n    Process Markdown content with advanced syntax highlighting.\n    \n    This function takes raw Markdown content and applies sophisticated\n    syntax highlighting with customizable themes and features.\n    \n    Args:\n        content (str): The raw Markdown content to process\n        language (str, optional): Programming language for syntax highlighting.\n            Defaults to &quot;markdown&quot;. Supported languages include:\n            - markdown, html, css, javascript, python, go, rust, etc.\n        theme (str, optional): Color theme for highlighting.\n            Defaults to &quot;default&quot;. Available themes:\n            - default, dark, light, github, monokai, solarized\n        line_numbers (bool, optional): Whether to show line numbers.\n            Defaults to True.\n        highlight_lines (List[int], optional): List of line numbers to highlight.\n            Defaults to None (no lines highlighted).\n    \n    Returns:\n        Dict[str, Any]: Processing result containing:\n            - &#x27;html&#x27;: Rendered HTML with syntax highlighting\n            - &#x27;metadata&#x27;: Processing metadata (language, theme, etc.)\n            - &#x27;statistics&#x27;: Processing statistics (line count, etc.)\n    \n    Raises:\n        ValueError: If the specified language is not supported\n        SyntaxError: If the content contains invalid syntax\n    \n    Example:\n        &gt;&gt;&gt; content = &#x27;&#x27;&#x27;\n        ... ```\u003C/span>python\n\u003Cspan class=\"hljs-code\">        ... def hello_world():\n        ...     print(&quot;Hello, World!&quot;)\n        ... ```\n        ... &#x27;&#x27;&#x27;\n        &gt;&gt;&gt; result = process_markdown_with_highlighting(\n        ...     content=content,\n        ...     language=&quot;python&quot;,\n        ...     theme=&quot;github&quot;,\n        ...     highlight_lines=[2]\n        ... )\n        &gt;&gt;&gt; print(result[&#x27;html&#x27;])\n        &lt;div class=&quot;highlight github-theme&quot;&gt;\n        &lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;\n        &lt;span class=&quot;lineno&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hello_world&lt;/span&gt;():\n        &lt;span class=&quot;lineno highlight&quot;&gt;2&lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;s&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;)\n        &lt;/code&gt;&lt;/pre&gt;\n        &lt;/div&gt;\n    \n    Note:\n        The function automatically detects code blocks within Markdown\n        and applies appropriate syntax highlighting. Custom themes can\n        be added by extending the theme configuration.\n    &quot;&quot;&quot;\n    \n    # Input validation\n    if not isinstance(content, str):\n        raise TypeError(&quot;Content must be a string&quot;)\n    \n    if language not in SUPPORTED_LANGUAGES:\n        raise ValueError(f&quot;Unsupported language: {language}&quot;)\n    \n    # Initialize processor with theme\n    processor = MarkdownProcessor(theme=theme)\n    \n    # Configure highlighting options\n    options = HighlightingOptions(\n        show_line_numbers=line_numbers,\n        highlight_lines=highlight_lines or [],\n        theme=theme\n    )\n    \n    try:\n        # Process the content\n        result = processor.process(content, language, options)\n        \n        # Generate metadata\n        metadata = {\n            &#x27;language&#x27;: language,\n            &#x27;theme&#x27;: theme,\n            &#x27;line_count&#x27;: content.count(&#x27;\\n&#x27;) + 1,\n            &#x27;processing_time&#x27;: result.processing_time,\n            &#x27;features_enabled&#x27;: {\n                &#x27;line_numbers&#x27;: line_numbers,\n                &#x27;highlighted_lines&#x27;: len(highlight_lines or [])\n            }\n        }\n        \n        # Compile statistics\n        statistics = {\n            &#x27;total_lines&#x27;: metadata[&#x27;line_count&#x27;],\n            &#x27;highlighted_lines&#x27;: len(highlight_lines or []),\n            &#x27;processing_duration_ms&#x27;: metadata[&#x27;processing_time&#x27;],\n            &#x27;html_size_bytes&#x27;: len(result.html.encode(&#x27;utf-8&#x27;))\n        }\n        \n        return {\n            &#x27;html&#x27;: result.html,\n            &#x27;metadata&#x27;: metadata,\n            &#x27;statistics&#x27;: statistics\n        }\n        \n    except Exception as e:\n        # Log the error for debugging\n        logger.error(f&quot;Failed to process markdown content: {e}&quot;)\n        \n        # Re-raise with context\n        raise SyntaxError(f&quot;Content processing failed: {e}&quot;) from e\n\u003C/span>\n\u003Cspan class=\"hljs-section\"># Example usage with error handling\u003C/span>\ndef main():\n\u003Cspan class=\"hljs-code\">    &quot;&quot;&quot;Example usage of the markdown processor.&quot;&quot;&quot;\n    \n    sample_content = &#x27;&#x27;&#x27;\n# Sample Document\n\u003C/span>\nHere&#x27;s a Python function example:\n\n\u003Cspan class=\"hljs-code\">```python\ndef fibonacci(n: int) -&gt; int:\n    &quot;&quot;&quot;Calculate the nth Fibonacci number.&quot;&quot;&quot;\n    if n &lt;= 1:\n        return n\n    return fibonacci(n-1) + fibonacci(n-2)\n\n# Generate first 10 Fibonacci numbers\nfor i in range(10):\n    print(f&quot;F({i}) = {fibonacci(i)}&quot;)\n```\u003C/span>\n\nAnd here&#x27;s a JavaScript version:\n\n\u003Cspan class=\"hljs-code\">```javascript\nfunction fibonacci(n) {\n    if (n &lt;= 1) return n;\n    return fibonacci(n - 1) + fibonacci(n - 2);\n}\n\n// Generate first 10 Fibonacci numbers\nfor (let i = 0; i &lt; 10; i++) {\n    console.log(`F(${i}) = ${fibonacci(i)}`);\n}\n```\u003C/span>\n\u003Cspan class=\"hljs-code\">    &#x27;&#x27;&#x27;\n    \n    try:\n        result = process_markdown_with_highlighting(\n            content=sample_content,\n            theme=&quot;github&quot;,\n            highlight_lines=[5, 6, 7]  # Highlight function definition\n        )\n        \n        print(&quot;Processing successful!&quot;)\n        print(f&quot;Generated HTML: {len(result[&#x27;html&#x27;])} bytes&quot;)\n        print(f&quot;Processing time: {result[&#x27;statistics&#x27;][&#x27;processing_duration_ms&#x27;]}ms&quot;)\n        \n    except (ValueError, SyntaxError) as e:\n        print(f&quot;Processing error: {e}&quot;)\n    except Exception as e:\n        print(f&quot;Unexpected error: {e}&quot;)\n\u003C/span>\nif \u003Cspan class=\"hljs-strong\">__name__\u003C/span> == &quot;\u003Cspan class=\"hljs-strong\">__main__\u003C/span>&quot;:\n\u003Cspan class=\"hljs-code\">    main()\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"advanced-highlighting-configuration\">Advanced Highlighting Configuration\u003C/h2>\n\u003Ch3 id=\"theme-customization-and-color-schemes\">Theme Customization and Color Schemes\u003C/h3>\n\u003Cp>Professional approaches to customizing syntax highlighting themes:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Custom Theme Configuration\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## CSS Theme Definition\u003C/span>\n\u003Cspan class=\"hljs-code\">```css\n/* GitHub-inspired syntax highlighting theme */\n.highlight.github-theme {\n    background-color: #f6f8fa;\n    border: 1px solid #d1d5da;\n    border-radius: 6px;\n    padding: 16px;\n    overflow-x: auto;\n    font-family: &#x27;SFMono-Regular&#x27;, Consolas, &#x27;Liberation Mono&#x27;, Menlo, monospace;\n    font-size: 14px;\n    line-height: 1.45;\n}\n\n.highlight.github-theme code {\n    background-color: transparent;\n    border: none;\n    padding: 0;\n    font-size: inherit;\n    color: inherit;\n    white-space: pre;\n    word-wrap: normal;\n}\n\n/* Line numbers */\n.highlight.github-theme .lineno {\n    color: #656d76;\n    user-select: none;\n    margin-right: 16px;\n    padding-right: 16px;\n    border-right: 1px solid #d1d5da;\n    display: inline-block;\n    min-width: 40px;\n    text-align: right;\n}\n\n.highlight.github-theme .lineno.highlight {\n    background-color: #fff8c5;\n    border-color: #f9c513;\n}\n\n/* Syntax highlighting colors */\n.highlight.github-theme .k { color: #d73a49; } /* Keywords */\n.highlight.github-theme .kn { color: #d73a49; } /* Keyword.Namespace */\n.highlight.github-theme .kp { color: #d73a49; } /* Keyword.Pseudo */\n.highlight.github-theme .kr { color: #d73a49; } /* Keyword.Reserved */\n.highlight.github-theme .kt { color: #d73a49; } /* Keyword.Type */\n\n.highlight.github-theme .s { color: #032f62; } /* Strings */\n.highlight.github-theme .s1 { color: #032f62; } /* String.Single */\n.highlight.github-theme .s2 { color: #032f62; } /* String.Double */\n.highlight.github-theme .se { color: #032f62; } /* String.Escape */\n.highlight.github-theme .si { color: #032f62; } /* String.Interpol */\n\n.highlight.github-theme .nb { color: #005cc5; } /* Name.Builtin */\n.highlight.github-theme .nf { color: #6f42c1; } /* Name.Function */\n.highlight.github-theme .nc { color: #6f42c1; } /* Name.Class */\n.highlight.github-theme .nn { color: #6f42c1; } /* Name.Namespace */\n\n.highlight.github-theme .m { color: #005cc5; } /* Numbers */\n.highlight.github-theme .mi { color: #005cc5; } /* Number.Integer */\n.highlight.github-theme .mf { color: #005cc5; } /* Number.Float */\n\n.highlight.github-theme .c { color: #6a737d; font-style: italic; } /* Comments */\n.highlight.github-theme .c1 { color: #6a737d; font-style: italic; } /* Comment.Single */\n.highlight.github-theme .cm { color: #6a737d; font-style: italic; } /* Comment.Multiline */\n\n.highlight.github-theme .o { color: #d73a49; } /* Operators */\n.highlight.github-theme .p { color: #24292e; } /* Punctuation */\n\n/* Dark theme variant */\n.highlight.github-dark-theme {\n    background-color: #0d1117;\n    border: 1px solid #30363d;\n    color: #f0f6fc;\n}\n\n.highlight.github-dark-theme .lineno {\n    color: #7d8590;\n    border-right-color: #30363d;\n}\n\n.highlight.github-dark-theme .lineno.highlight {\n    background-color: #ffd33d1a;\n    border-color: #ffd33d;\n}\n\n.highlight.github-dark-theme .k { color: #ff7b72; }\n.highlight.github-dark-theme .s { color: #a5d6ff; }\n.highlight.github-dark-theme .nb { color: #79c0ff; }\n.highlight.github-dark-theme .nf { color: #d2a8ff; }\n.highlight.github-dark-theme .nc { color: #d2a8ff; }\n.highlight.github-dark-theme .m { color: #79c0ff; }\n.highlight.github-dark-theme .c { color: #8b949e; }\n.highlight.github-dark-theme .o { color: #ff7b72; }\n.highlight.github-dark-theme .p { color: #f0f6fc; }\n\n/* Interactive features */\n.highlight pre {\n    position: relative;\n}\n\n.highlight .copy-button {\n    position: absolute;\n    top: 8px;\n    right: 8px;\n    background: #24292e;\n    color: #fff;\n    border: none;\n    border-radius: 4px;\n    padding: 4px 8px;\n    font-size: 12px;\n    cursor: pointer;\n    opacity: 0;\n    transition: opacity 0.2s ease;\n}\n\n.highlight:hover .copy-button {\n    opacity: 1;\n}\n\n.highlight .copy-button:hover {\n    background: #1b1f23;\n}\n\n.highlight .copy-button.copied {\n    background: #28a745;\n}\n\n/* Responsive design */\n@media (max-width: 768px) {\n    .highlight {\n        font-size: 12px;\n        padding: 12px;\n    }\n    \n    .highlight .lineno {\n        min-width: 30px;\n        margin-right: 8px;\n        padding-right: 8px;\n    }\n}\n\n/* Print styles */\n@media print {\n    .highlight {\n        border: 1px solid #000;\n        background: #fff !important;\n        color: #000 !important;\n    }\n    \n    .highlight * {\n        color: #000 !important;\n        background: transparent !important;\n    }\n    \n    .highlight .copy-button {\n        display: none;\n    }\n}\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## JavaScript Enhancement\u003C/span>\n\u003Cspan class=\"hljs-code\">```javascript\n/**\n * Enhanced code block functionality with copy, expand, and interaction features\n */\nclass CodeBlockEnhancer {\n    constructor(options = {}) {\n        this.options = {\n            enableCopy: true,\n            enableLineNumbers: true,\n            enableHighlighting: true,\n            enableExpansion: true,\n            maxHeight: 400, // pixels\n            ...options\n        };\n        \n        this.clipboard = null;\n        this.init();\n    }\n    \n    async init() {\n        // Initialize clipboard API if available\n        if (navigator.clipboard) {\n            this.clipboard = navigator.clipboard;\n        }\n        \n        // Process all code blocks\n        this.enhanceCodeBlocks();\n        \n        // Set up event listeners\n        this.setupEventListeners();\n    }\n    \n    enhanceCodeBlocks() {\n        const codeBlocks = document.querySelectorAll(&#x27;pre code&#x27;);\n        \n        codeBlocks.forEach((block, index) =&gt; {\n            this.enhanceCodeBlock(block, index);\n        });\n    }\n    \n    enhanceCodeBlock(codeBlock, index) {\n        const pre = codeBlock.parentElement;\n        const wrapper = document.createElement(&#x27;div&#x27;);\n        wrapper.className = &#x27;enhanced-code-block&#x27;;\n        wrapper.dataset.blockId = index;\n        \n        // Wrap the pre element\n        pre.parentElement.insertBefore(wrapper, pre);\n        wrapper.appendChild(pre);\n        \n        // Add toolbar\n        if (this.options.enableCopy) {\n            this.addCopyButton(wrapper, codeBlock);\n        }\n        \n        // Add line numbers if not present\n        if (this.options.enableLineNumbers &amp;&amp; !codeBlock.querySelector(&#x27;.lineno&#x27;)) {\n            this.addLineNumbers(codeBlock);\n        }\n        \n        // Add expansion for long code blocks\n        if (this.options.enableExpansion) {\n            this.addExpansionFeature(wrapper, pre);\n        }\n        \n        // Add language detection and highlighting\n        if (this.options.enableHighlighting) {\n            this.enhanceSyntaxHighlighting(codeBlock);\n        }\n    }\n    \n    addCopyButton(wrapper, codeBlock) {\n        const toolbar = document.createElement(&#x27;div&#x27;);\n        toolbar.className = &#x27;code-toolbar&#x27;;\n        \n        const copyButton = document.createElement(&#x27;button&#x27;);\n        copyButton.className = &#x27;copy-button&#x27;;\n        copyButton.innerHTML = `\n            &lt;svg width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 16 16&quot; fill=&quot;currentColor&quot;&gt;\n                &lt;path d=&quot;M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z&quot;/&gt;\n                &lt;path d=&quot;M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z&quot;/&gt;\n            &lt;/svg&gt;\n            Copy\n        `;\n        copyButton.title = &#x27;Copy code to clipboard&#x27;;\n        \n        copyButton.addEventListener(&#x27;click&#x27;, () =&gt; {\n            this.copyCode(codeBlock, copyButton);\n        });\n        \n        toolbar.appendChild(copyButton);\n        wrapper.insertBefore(toolbar, wrapper.firstChild);\n    }\n    \n    async copyCode(codeBlock, button) {\n        // Get the code text without line numbers\n        let code = codeBlock.textContent;\n        \n        // Remove line numbers if present\n        code = code.replace(/^\\s*\\d+\\s*/gm, &#x27;&#x27;);\n        \n        try {\n            if (this.clipboard) {\n                await this.clipboard.writeText(code);\n            } else {\n                // Fallback for older browsers\n                this.fallbackCopy(code);\n            }\n            \n            // Visual feedback\n            const originalText = button.innerHTML;\n            button.innerHTML = `\n                &lt;svg width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 16 16&quot; fill=&quot;currentColor&quot;&gt;\n                    &lt;path d=&quot;M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z&quot;/&gt;\n                &lt;/svg&gt;\n                Copied!\n            `;\n            button.classList.add(&#x27;copied&#x27;);\n            \n            setTimeout(() =&gt; {\n                button.innerHTML = originalText;\n                button.classList.remove(&#x27;copied&#x27;);\n            }, 2000);\n            \n        } catch (error) {\n            console.error(&#x27;Failed to copy code:&#x27;, error);\n            \n            // Show error feedback\n            button.innerHTML = &#x27;Copy failed&#x27;;\n            setTimeout(() =&gt; {\n                button.innerHTML = originalText;\n            }, 2000);\n        }\n    }\n    \n    fallbackCopy(text) {\n        const textArea = document.createElement(&#x27;textarea&#x27;);\n        textArea.value = text;\n        textArea.style.position = &#x27;fixed&#x27;;\n        textArea.style.left = &#x27;-999999px&#x27;;\n        textArea.style.top = &#x27;-999999px&#x27;;\n        document.body.appendChild(textArea);\n        textArea.focus();\n        textArea.select();\n        \n        try {\n            document.execCommand(&#x27;copy&#x27;);\n        } catch (error) {\n            throw new Error(&#x27;Clipboard not supported&#x27;);\n        } finally {\n            document.body.removeChild(textArea);\n        }\n    }\n    \n    addLineNumbers(codeBlock) {\n        const lines = codeBlock.textContent.split(&#x27;\\n&#x27;);\n        const numberedLines = lines.map((line, index) =&gt; {\n            const lineNumber = index + 1;\n            return `&lt;span class=&quot;lineno&quot;&gt;${lineNumber}&lt;/span&gt;${line}`;\n        });\n        \n        codeBlock.innerHTML = numberedLines.join(&#x27;\\n&#x27;);\n    }\n    \n    addExpansionFeature(wrapper, pre) {\n        const maxHeight = this.options.maxHeight;\n        \n        if (pre.scrollHeight &gt; maxHeight) {\n            pre.style.maxHeight = maxHeight + &#x27;px&#x27;;\n            pre.style.overflow = &#x27;hidden&#x27;;\n            \n            const expandButton = document.createElement(&#x27;button&#x27;);\n            expandButton.className = &#x27;expand-button&#x27;;\n            expandButton.textContent = &#x27;Show more&#x27;;\n            \n            expandButton.addEventListener(&#x27;click&#x27;, () =&gt; {\n                if (pre.style.maxHeight) {\n                    pre.style.maxHeight = &#x27;&#x27;;\n                    pre.style.overflow = &#x27;auto&#x27;;\n                    expandButton.textContent = &#x27;Show less&#x27;;\n                } else {\n                    pre.style.maxHeight = maxHeight + &#x27;px&#x27;;\n                    pre.style.overflow = &#x27;hidden&#x27;;\n                    expandButton.textContent = &#x27;Show more&#x27;;\n                }\n            });\n            \n            wrapper.appendChild(expandButton);\n        }\n    }\n    \n    enhanceSyntaxHighlighting(codeBlock) {\n        // Detect language if not specified\n        const pre = codeBlock.parentElement;\n        let language = this.detectLanguage(codeBlock);\n        \n        if (language &amp;&amp; !pre.classList.contains(&#x27;language-&#x27; + language)) {\n            pre.classList.add(&#x27;language-&#x27; + language);\n            codeBlock.classList.add(&#x27;language-&#x27; + language);\n        }\n    }\n    \n    detectLanguage(codeBlock) {\n        const code = codeBlock.textContent;\n        \n        // Simple language detection patterns\n        const patterns = {\n            javascript: /(?:function|const|let|var|=&amp;gt;|\\.js)/,\n            python: /(?:def |import |from |print\\(|\\.py)/,\n            html: /&amp;lt;\\w+[^&amp;gt;]*&amp;gt;/,\n            css: /\\{[^}]*:[^}]*\\}/,\n            json: /^\\s*[\\{\\[]/,\n            bash: /^\\s*(?:\\$|#)/,\n            sql: /(?:SELECT|FROM|WHERE|INSERT|UPDATE|DELETE)/i\n        };\n        \n        for (const [lang, pattern] of Object.entries(patterns)) {\n            if (pattern.test(code)) {\n                return lang;\n            }\n        }\n        \n        return null;\n    }\n    \n    setupEventListeners() {\n        // Keyboard shortcuts\n        document.addEventListener(&#x27;keydown&#x27;, (event) =&gt; {\n            // Ctrl/Cmd + C on focused code block\n            if ((event.ctrlKey || event.metaKey) &amp;&amp; event.key === &#x27;c&#x27;) {\n                const focused = document.activeElement;\n                if (focused &amp;&amp; focused.closest(&#x27;.enhanced-code-block&#x27;)) {\n                    event.preventDefault();\n                    const codeBlock = focused.closest(&#x27;.enhanced-code-block&#x27;).querySelector(&#x27;code&#x27;);\n                    const copyButton = focused.closest(&#x27;.enhanced-code-block&#x27;).querySelector(&#x27;.copy-button&#x27;);\n                    if (codeBlock &amp;&amp; copyButton) {\n                        this.copyCode(codeBlock, copyButton);\n                    }\n                }\n            }\n        });\n        \n        // Make code blocks focusable for keyboard navigation\n        document.querySelectorAll(&#x27;.enhanced-code-block pre&#x27;).forEach(pre =&gt; {\n            pre.setAttribute(&#x27;tabindex&#x27;, &#x27;0&#x27;);\n            pre.setAttribute(&#x27;role&#x27;, &#x27;region&#x27;);\n            pre.setAttribute(&#x27;aria-label&#x27;, &#x27;Code example&#x27;);\n        });\n    }\n}\n\n// Initialize when DOM is ready\ndocument.addEventListener(&#x27;DOMContentLoaded&#x27;, () =&gt; {\n    new CodeBlockEnhancer({\n        enableCopy: true,\n        enableLineNumbers: true,\n        enableExpansion: true,\n        maxHeight: 400\n    });\n});\n\n// Export for module systems\nif (typeof module !== &#x27;undefined&#x27; &amp;&amp; module.exports) {\n    module.exports = CodeBlockEnhancer;\n}\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"integration-with-documentation-systems\">Integration with Documentation Systems\u003C/h2>\n\u003Cp>Code highlighting systems integrate seamlessly with comprehensive documentation workflows. When combined with \u003Ca href=\"/blog/markdown-table-accessibility-aria-complete-guide\">table accessibility and structured data presentation\u003C/a>, enhanced code blocks provide complete technical documentation experiences that serve developers with varying needs and assistive technology requirements while maintaining consistent presentation standards.\u003C/p>\n\u003Cp>For sophisticated content management, code highlighting works effectively with \u003Ca href=\"/blog/markdown-performance-optimization-rendering-speed-guide\">performance optimization systems\u003C/a> to ensure that syntax highlighting processing doesn&#39;t impact page load times, implementing efficient caching strategies and lazy loading techniques for code-heavy documentation platforms.\u003C/p>\n\u003Cp>When building comprehensive documentation architectures, code highlighting complements \u003Ca href=\"/blog/markdown-custom-html-components-complete-guide\">custom HTML components and extensions\u003C/a> by providing specialized code presentation components that integrate seamlessly with interactive documentation features while maintaining the simplicity of Markdown authoring workflows.\u003C/p>\n\u003Ch3 id=\"platform-specific-implementation\">Platform-Specific Implementation\u003C/h3>\n\u003Cp>Advanced integration techniques for popular documentation platforms:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Platform Integration Examples\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Jekyll Integration\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\n# _config.yml - Jekyll configuration for enhanced code highlighting\nhighlighter: rouge\nmarkdown: kramdown\n\nkramdown:\n  input: GFM\n  syntax_highlighter: rouge\n  syntax_highlighter_opts:\n    line_numbers: true\n    tab_width: 4\n    wrap: false\n    bold_every: 5\n\nplugins:\n  - jekyll-sitemap\n  - jekyll-feed\n  - rouge-themes\n\nrouge:\n  themes:\n    - github\n    - monokai\n    - solarized\n  \ncollections:\n  code_examples:\n    output: true\n    permalink: /:collection/:name/\n\ndefaults:\n  - scope:\n      path: &quot;_code_examples&quot;\n      type: &quot;code_examples&quot;\n    values:\n      layout: &quot;code_example&quot;\n      syntax_highlighting: true\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Hugo Integration\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\n# config.yaml - Hugo configuration for code highlighting\nmarkup:\n  goldmark:\n    renderer:\n      unsafe: true\n  highlight:\n    lineNos: true\n    lineNumbersInTable: true\n    tabWidth: 4\n    style: github\n    noClasses: false\n    anchorLineNos: false\n    codeFences: true\n    guessSyntax: true\n    hl_Lines: &quot;&quot;\n\nparams:\n  code:\n    copy: true\n    maxShownLines: 50\n    theme: &quot;github&quot;\n    themes:\n      - github\n      - github-dark\n      - monokai\n      - solarized-dark\n      - solarized-light\n\nmenu:\n  main:\n    - name: &quot;Code Examples&quot;\n      url: &quot;/examples/&quot;\n      weight: 30\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## GitBook Integration\u003C/span>\n\u003Cspan class=\"hljs-code\">```javascript\n// book.json - GitBook plugin configuration\n{\n    &quot;plugins&quot;: [\n        &quot;advanced-code-blocks&quot;,\n        &quot;code-highlighter&quot;,\n        &quot;copy-code-button&quot;,\n        &quot;tab-groups&quot;\n    ],\n    &quot;pluginsConfig&quot;: {\n        &quot;advanced-code-blocks&quot;: {\n            &quot;theme&quot;: &quot;github&quot;,\n            &quot;lineNumbers&quot;: true,\n            &quot;copyButton&quot;: true,\n            &quot;maxHeight&quot;: 400\n        },\n        &quot;code-highlighter&quot;: {\n            &quot;themes&quot;: [\n                &quot;github&quot;,\n                &quot;monokai&quot;,\n                &quot;solarized-dark&quot;\n            ],\n            &quot;autoDetect&quot;: true,\n            &quot;supportedLanguages&quot;: [\n                &quot;javascript&quot;,\n                &quot;python&quot;,\n                &quot;go&quot;,\n                &quot;rust&quot;,\n                &quot;typescript&quot;,\n                &quot;bash&quot;,\n                &quot;sql&quot;,\n                &quot;yaml&quot;,\n                &quot;json&quot;\n            ]\n        },\n        &quot;copy-code-button&quot;: {\n            &quot;copyText&quot;: &quot;Copy to clipboard&quot;,\n            &quot;copiedText&quot;: &quot;Copied!&quot;,\n            &quot;copyError&quot;: &quot;Copy failed&quot;\n        },\n        &quot;tab-groups&quot;: {\n            &quot;enableScrolling&quot;: true,\n            &quot;theme&quot;: &quot;default&quot;\n        }\n    }\n}\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"troubleshooting-and-best-practices\">Troubleshooting and Best Practices\u003C/h2>\n\u003Ch3 id=\"common-issues-and-solutions\">Common Issues and Solutions\u003C/h3>\n\u003Cp>\u003Cstrong>Problem\u003C/strong>: Code blocks not highlighting properly\u003C/p>\n\u003Cp>\u003Cstrong>Solutions\u003C/strong>:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">&lt;!-- Ensure language specification is correct --&gt;\n❌ Incorrect:\n\u003Cspan class=\"hljs-code\">```\n// JavaScript code but no language specified\nfunction example() {\n    return &quot;Hello World&quot;;\n}\n```\u003C/span>\n\n✅ Correct:\n\u003Cspan class=\"hljs-code\">```javascript\n// JavaScript code with proper language specification\nfunction example() {\n    return &quot;Hello World&quot;;\n}\n```\u003C/span>\n\n&lt;!-- Check for unsupported language identifiers --&gt;\n❌ Problematic:\n\u003Cspan class=\"hljs-code\">```js-react\n// Non-standard language identifier\nconst Component = () =&gt; &lt;div&gt;Hello&lt;/div&gt;;\n```\u003C/span>\n\n✅ Better:\n\u003Cspan class=\"hljs-code\">```jsx\n// Standard JSX identifier\nconst Component = () =&gt; &lt;div&gt;Hello&lt;/div&gt;;\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Cp>\u003Cstrong>Problem\u003C/strong>: Line numbers not displaying correctly\u003C/p>\n\u003Cp>\u003Cstrong>Solutions\u003C/strong>:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-css\">\u003Cspan class=\"hljs-comment\">/* Ensure proper CSS is loaded */\u003C/span>\n\u003Cspan class=\"hljs-selector-class\">.highlight\u003C/span> \u003Cspan class=\"hljs-selector-class\">.lineno\u003C/span> {\n    \u003Cspan class=\"hljs-attribute\">display\u003C/span>: inline-block \u003Cspan class=\"hljs-meta\">!important\u003C/span>;\n    \u003Cspan class=\"hljs-attribute\">min-width\u003C/span>: \u003Cspan class=\"hljs-number\">2em\u003C/span>;\n    \u003Cspan class=\"hljs-attribute\">margin-right\u003C/span>: \u003Cspan class=\"hljs-number\">1em\u003C/span>;\n    \u003Cspan class=\"hljs-attribute\">text-align\u003C/span>: right;\n    \u003Cspan class=\"hljs-attribute\">color\u003C/span>: \u003Cspan class=\"hljs-number\">#666\u003C/span>;\n}\n\n\u003Cspan class=\"hljs-comment\">/* Fix for responsive design */\u003C/span>\n\u003Cspan class=\"hljs-keyword\">@media\u003C/span> (\u003Cspan class=\"hljs-attribute\">max-width\u003C/span>: \u003Cspan class=\"hljs-number\">600px\u003C/span>) {\n    \u003Cspan class=\"hljs-selector-class\">.highlight\u003C/span> \u003Cspan class=\"hljs-selector-class\">.lineno\u003C/span> {\n        \u003Cspan class=\"hljs-attribute\">min-width\u003C/span>: \u003Cspan class=\"hljs-number\">1.5em\u003C/span>;\n        \u003Cspan class=\"hljs-attribute\">font-size\u003C/span>: \u003Cspan class=\"hljs-number\">0.8em\u003C/span>;\n    }\n}\n\u003C/code>\u003C/pre>\u003Cp>\u003Cstrong>Problem\u003C/strong>: Copy functionality not working\u003C/p>\n\u003Cp>\u003Cstrong>Solutions\u003C/strong>:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-javascript\">\u003Cspan class=\"hljs-comment\">// Enhanced clipboard fallback\u003C/span>\n\u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-keyword\">function\u003C/span> \u003Cspan class=\"hljs-title function_\">copyToClipboard\u003C/span>(\u003Cspan class=\"hljs-params\">text\u003C/span>) {\n    \u003Cspan class=\"hljs-comment\">// Try modern Clipboard API first\u003C/span>\n    \u003Cspan class=\"hljs-keyword\">if\u003C/span> (navigator.\u003Cspan class=\"hljs-property\">clipboard\u003C/span> &amp;&amp; \u003Cspan class=\"hljs-variable language_\">window\u003C/span>.\u003Cspan class=\"hljs-property\">isSecureContext\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">await\u003C/span> navigator.\u003Cspan class=\"hljs-property\">clipboard\u003C/span>.\u003Cspan class=\"hljs-title function_\">writeText\u003C/span>(text);\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">true\u003C/span>;\n        } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> (error) {\n            \u003Cspan class=\"hljs-variable language_\">console\u003C/span>.\u003Cspan class=\"hljs-title function_\">warn\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;Clipboard API failed:&#x27;\u003C/span>, error);\n        }\n    }\n    \n    \u003Cspan class=\"hljs-comment\">// Fallback for older browsers or insecure contexts\u003C/span>\n    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-title function_\">fallbackCopyTextToClipboard\u003C/span>(text);\n}\n\n\u003Cspan class=\"hljs-keyword\">function\u003C/span> \u003Cspan class=\"hljs-title function_\">fallbackCopyTextToClipboard\u003C/span>(\u003Cspan class=\"hljs-params\">text\u003C/span>) {\n    \u003Cspan class=\"hljs-keyword\">const\u003C/span> textArea = \u003Cspan class=\"hljs-variable language_\">document\u003C/span>.\u003Cspan class=\"hljs-title function_\">createElement\u003C/span>(\u003Cspan class=\"hljs-string\">&quot;textarea&quot;\u003C/span>);\n    textArea.\u003Cspan class=\"hljs-property\">value\u003C/span> = text;\n    \n    \u003Cspan class=\"hljs-comment\">// Avoid scrolling to bottom\u003C/span>\n    textArea.\u003Cspan class=\"hljs-property\">style\u003C/span>.\u003Cspan class=\"hljs-property\">top\u003C/span> = \u003Cspan class=\"hljs-string\">&quot;0&quot;\u003C/span>;\n    textArea.\u003Cspan class=\"hljs-property\">style\u003C/span>.\u003Cspan class=\"hljs-property\">left\u003C/span> = \u003Cspan class=\"hljs-string\">&quot;0&quot;\u003C/span>;\n    textArea.\u003Cspan class=\"hljs-property\">style\u003C/span>.\u003Cspan class=\"hljs-property\">position\u003C/span> = \u003Cspan class=\"hljs-string\">&quot;fixed&quot;\u003C/span>;\n    textArea.\u003Cspan class=\"hljs-property\">style\u003C/span>.\u003Cspan class=\"hljs-property\">opacity\u003C/span> = \u003Cspan class=\"hljs-string\">&quot;0&quot;\u003C/span>;\n    \n    \u003Cspan class=\"hljs-variable language_\">document\u003C/span>.\u003Cspan class=\"hljs-property\">body\u003C/span>.\u003Cspan class=\"hljs-title function_\">appendChild\u003C/span>(textArea);\n    textArea.\u003Cspan class=\"hljs-title function_\">focus\u003C/span>();\n    textArea.\u003Cspan class=\"hljs-title function_\">select\u003C/span>();\n    \n    \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> successful = \u003Cspan class=\"hljs-variable language_\">document\u003C/span>.\u003Cspan class=\"hljs-title function_\">execCommand\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;copy&#x27;\u003C/span>);\n        \u003Cspan class=\"hljs-variable language_\">document\u003C/span>.\u003Cspan class=\"hljs-property\">body\u003C/span>.\u003Cspan class=\"hljs-title function_\">removeChild\u003C/span>(textArea);\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> successful;\n    } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> (err) {\n        \u003Cspan class=\"hljs-variable language_\">console\u003C/span>.\u003Cspan class=\"hljs-title function_\">error\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;Fallback copy failed:&#x27;\u003C/span>, err);\n        \u003Cspan class=\"hljs-variable language_\">document\u003C/span>.\u003Cspan class=\"hljs-property\">body\u003C/span>.\u003Cspan class=\"hljs-title function_\">removeChild\u003C/span>(textArea);\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n    }\n}\n\u003C/code>\u003C/pre>\u003Ch2 id=\"conclusion\">Conclusion\u003C/h2>\n\u003Cp>Advanced Markdown code highlighting represents a critical component of professional technical documentation that enhances code comprehension, improves learning outcomes, and creates polished presentation standards for programming examples and technical tutorials. By implementing proper syntax specification, custom theme configuration, and interactive enhancement features, technical writers can create compelling documentation that serves developers across different skill levels and accessibility needs.\u003C/p>\n\u003Cp>The key to successful code highlighting lies in understanding both the technical implementation details and the user experience considerations that make code examples truly valuable for readers. Whether you&#39;re building simple tutorials or comprehensive API documentation, the techniques covered in this guide provide the foundation for creating professional-grade code presentation that enhances rather than complicates the content creation process.\u003C/p>\n\u003Cp>Remember to test your highlighting implementation across different browsers and devices, implement proper accessibility features for screen readers and keyboard navigation, and maintain consistency in your code presentation standards throughout your documentation. With proper implementation of advanced code highlighting techniques, your Markdown documentation can achieve the professional polish and technical accuracy that modern developers expect from high-quality technical content.\u003C/p>\n",[15,19,22,25,28,31,34,37],{"id":16,"text":17,"level":18},"why-master-code-highlighting-in-markdown","Why Master Code Highlighting in Markdown?",2,{"id":20,"text":21,"level":18},"foundation-code-block-syntax","Foundation Code Block Syntax",{"id":23,"text":24,"level":18},"language-specific-highlighting-techniques","Language-Specific Highlighting Techniques",{"id":26,"text":27,"level":18},"interactive-code-features","Interactive Code Features",{"id":29,"text":30,"level":18},"advanced-highlighting-configuration","Advanced Highlighting Configuration",{"id":32,"text":33,"level":18},"integration-with-documentation-systems","Integration with Documentation Systems",{"id":35,"text":36,"level":18},"troubleshooting-and-best-practices","Troubleshooting and Best Practices",{"id":38,"text":39,"level":18},"conclusion","Conclusion",[],[42,50,58],{"slug":43,"title":44,"description":45,"excerpt":46,"date":47,"category":9,"author":10,"keywords":48,"readingMinutes":49},"markdown-code-block-syntax-highlighting-language-specification-complete-guide","Markdown Code Block Syntax Highlighting and Language Specification: Complete Guide to Enhanced Code Display and Documentation","Master advanced Markdown code block syntax highlighting, language specification, and enhanced code display for technical documentation. Learn highlighting techniques, language identifiers, and code presentation best practices.","Advanced Markdown code block syntax highlighting and language specification enable sophisticated technical documentation that provides clear, readable code examples with proper syntax coloring,…","2025-12-11","markdown code blocks, syntax highlighting markdown, code block languages, markdown code syntax, programming language markdown, code highlighting, fenced code blocks, markdown code display",22,{"slug":51,"title":52,"description":53,"excerpt":54,"date":55,"category":9,"author":10,"keywords":56,"readingMinutes":57},"markdown-syntax-highlighting-complete-guide","Markdown Syntax Highlighting: Complete Guide for Code Blocks","Master syntax highlighting in Markdown code blocks across platforms. Learn language identifiers, custom highlighting, and platform-specific features for better code presentation.","Code blocks are one of Markdown's most powerful features for technical writing, and syntax highlighting transforms plain code into readable, professionally formatted content. Understanding how to…","2025-08-18","markdown syntax highlighting, markdown code blocks, language highlighting, code formatting markdown, syntax coloring markdown, programming language markdown",8,{"slug":59,"title":60,"description":61,"excerpt":62,"date":63,"category":9,"author":10,"keywords":64,"readingMinutes":65},"markdown-code-annotations-documentation-complete-guide","Markdown Code Annotations and Documentation: Complete Guide for Technical Writing","Master code annotations, inline documentation, and technical writing in Markdown. Learn to create annotated code examples, documentation comments, and professional technical guides with proper formatting.","Code annotations and documentation in Markdown bridge the gap between raw code examples and comprehensive technical explanations, enabling writers to create clear, educational content that helps…","2025-08-31","markdown code annotations, markdown documentation, code comments markdown, technical writing markdown, annotated code examples, markdown code blocks, documentation comments",20,1792184942648]