Skip to content

Code examples display incorrectly in Firefox #67

@Z2Flow

Description

@Z2Flow

All the code examples display on one line in Firefox.
I installed Tampermonkey and added this script to fix the problem:

// ==UserScript==
// @name         Fix Stimulus Code Blocks
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add line breaks to code blocks
// @match        https://stimulus.hotwired.dev/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    
    // Wait for page to load
    setTimeout(() => {
        document.querySelectorAll('pre.language-html code').forEach(code => {
            // Replace double spaces with <br> + double spaces
            code.innerHTML = code.innerHTML.replace(/>\s{2}</g, '><br>  <');
        });
    }, 500);
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions