Global Monospace Enforcer

Forces all code blocks and monospaced text to use your browser's default monospace font settings. Removes site-specific overrides (like ui-monospace, Menlo, Consolas) so you can enjoy your preferred font globally.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Global Monospace Enforcer
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Forces all code blocks and monospaced text to use your browser's default monospace font settings. Removes site-specific overrides (like ui-monospace, Menlo, Consolas) so you can enjoy your preferred font globally.
// @author       Xinde
// @match        *://*/*
// @grant        GM_addStyle
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    /* ==========================================================================
       CONFIGURATION
       Change 'monospace' below to a specific font name (e.g., 'Fira Code')
       if you want to force a specific font instead of the browser default.
       ========================================================================== */
    const PREFERRED_FONT = "monospace";

    /* ==========================================================================
       THE CSS PAYLOAD
       This is the CSS that will be injected into every page.
       ========================================================================== */
    const css = `
        /* CORE: Standard HTML Elements */
        pre, code, kbd, samp, var, tt {
            font-family: ${PREFERRED_FONT} !important;
            font-feature-settings: normal !important;
        }

        /* PLATFORMS: GitHub, GitLab, BitBucket */
        .blob-code, .blob-code-inner, .react-code-text, .file-content code, .gitlab-monaco-editor,
        
        /* IDEs: VS Code Web, Monaco Editor, Azure DevOps */
        .monaco-editor, .monaco-editor .view-lines, .monaco-workbench,
        
        /* FORUMS: StackOverflow, StackExchange */
        .s-prose code, .s-prose pre,

        /* EDITORS: CodeMirror, Ace, ProseMirror */
        .CodeMirror, .CodeMirror-lines,
        .ace_editor, .ace_text-layer,
        .ProseMirror code,
        
        /* APPS: Notion, Slack, Jira, ChatGPT */
        .notion-code-block,
        .c-mrkdwn__pre, .c-mrkdwn__code,
        .code-block, .code-content,
        .markdown prose pre, .markdown prose code,
        
        /* GENERAL: Fallbacks for other sites */
        [class*="monospace"],
        [class*="code-block"],
        [class*="highlight"] {
            font-family: ${PREFERRED_FONT} !important;
        }

        /* INPUTS: Textareas intended for code */
        textarea.source-code,
        textarea.code,
        textarea#read-only-cursor-text-area {
            font-family: ${PREFERRED_FONT} !important;
        }
    `;

    /* ==========================================================================
       INJECTION LOGIC
       Uses GM_addStyle for best performance and instant loading.
       ========================================================================== */
    if (typeof GM_addStyle !== "undefined") {
        GM_addStyle(css);
    } else {
        // Fallback for script managers that don't support GM_addStyle
        const style = document.createElement('style');
        style.textContent = css;
        (document.head || document.documentElement).appendChild(style);
    }

})();