From 7603972889edb33aaf15983245fed5229b3943b6 Mon Sep 17 00:00:00 2001 From: Hatem Hosny Date: Wed, 1 Jan 2025 20:05:18 +0200 Subject: [PATCH] feat: allow running code in playground --- source/_posts/javascript.md | 1 + source/_posts/python.md | 1 + themes/coo/layout/_partial/scripts.ejs | 64 ++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/source/_posts/javascript.md b/source/_posts/javascript.md index 392126d..758d3b2 100644 --- a/source/_posts/javascript.md +++ b/source/_posts/javascript.md @@ -11,6 +11,7 @@ intro: | A JavaScript cheat sheet with the most important concepts, functions, methods, and more. A complete quick reference for beginners. plugins: - copyCode + - runCode --- ## Getting Started diff --git a/source/_posts/python.md b/source/_posts/python.md index 53f3220..e0c670b 100644 --- a/source/_posts/python.md +++ b/source/_posts/python.md @@ -11,6 +11,7 @@ intro: | The [Python](https://www.python.org/) cheat sheet is a one-page reference sheet for the Python 3 programming language. plugins: - copyCode + - runCode --- ## Getting Started diff --git a/themes/coo/layout/_partial/scripts.ejs b/themes/coo/layout/_partial/scripts.ejs index 41c0302..7093f53 100644 --- a/themes/coo/layout/_partial/scripts.ejs +++ b/themes/coo/layout/_partial/scripts.ejs @@ -72,3 +72,67 @@ }); <% } %> + + +<% if (is_post() && page.plugins != undefined && page.plugins.includes("runCode") ){ %> + + +<% } %>