From da53b553bab89b1bd90fcdd1e426270fc427a8d0 Mon Sep 17 00:00:00 2001 From: Hatem Hosny Date: Sun, 5 Jan 2025 17:17:56 +0200 Subject: [PATCH] feat: add support for running ruby --- source/_posts/ruby.md | 1 + themes/coo/layout/_partial/scripts.ejs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/_posts/ruby.md b/source/_posts/ruby.md index eee2041..10803dc 100644 --- a/source/_posts/ruby.md +++ b/source/_posts/ruby.md @@ -11,6 +11,7 @@ intro: | The [Ruby](https://www.ruby-lang.org/) cheat sheet is a one-page reference sheet for the Ruby programming language. plugins: - copyCode + - runCode --- ## Getting Started diff --git a/themes/coo/layout/_partial/scripts.ejs b/themes/coo/layout/_partial/scripts.ejs index 57a39f3..ab1cd88 100644 --- a/themes/coo/layout/_partial/scripts.ejs +++ b/themes/coo/layout/_partial/scripts.ejs @@ -85,7 +85,7 @@ let content = codeBlock.textContent || ''; let language = [...codeBlock.classList].filter(c => c.startsWith("language-"))[0].replace("language-", ""); - if (language === 'shell') return; + if (['shell', 'bash'].includes(language)) return; // Create a run button element const runButton = document.createElement('button'); @@ -103,7 +103,7 @@ language = 'typescript'; } - const editorId = ['js', 'javascript', 'typescript', 'python', 'php'].includes(language) + const editorId = ['js', 'javascript', 'typescript', 'python', 'php', 'ruby'].includes(language) ? 'script' : ['css', 'scss'].includes(language) ? 'style'