Skip to content

Commit

Permalink
feat: add free code execution page
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesx00 committed Dec 21, 2024
1 parent 4d3713c commit 0bd679b
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 1 deletion.
3 changes: 3 additions & 0 deletions _includes/footer.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<li class="cs-nav-li">
<a class="cs-nav-link" href="/diff-editor/">Diff editor</a>
</li>
<li class="cs-nav-li">
<a class="cs-nav-link" href="/code-execution/">Run your code</a>
</li>
</ul>
<ul class="mb-6">
<li class="cs-nav-li">
Expand Down
2 changes: 2 additions & 0 deletions _includes/layouts/lesson.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ layout: layouts/base.njk
</button>
<div class="py-6 px-4 bg-gray-50 dark:bg-zinc-900 min-h-screen">
<div class="grid md:flex gap-4 md:justify-center">
{% if not hide_content %}
<div class="md:flex-1 max-w-prose overflow-y-hidden">
<div class="mb-6 mx-auto bg-white dark:bg-zinc-950 p-4 {% if not code_editor %}max-w-prose{% endif %}">
<p class="text-gray-500 dark:text-slate-300 text-xs font-light mb-2">
Expand Down Expand Up @@ -48,6 +49,7 @@ layout: layouts/base.njk
</div>
</div>
</div>
{% endif %}
{% if code_editor %}
<div class="relative flex-1">
<div class="sticky top-4">
Expand Down
2 changes: 1 addition & 1 deletion eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = function (eleventyConfig) {
// https://www.11ty.dev/docs/watch-serve/#add-your-own-watch-targets

// Watch content images for the image pipeline.
eleventyConfig.addWatchTarget("src/**/*.{svg,webp,png,jpeg,py}");
eleventyConfig.addWatchTarget("src/**/*.{svg,webp,png,jpeg,py,txt,sql,ts}");

// App plugins
eleventyConfig.addPlugin(pluginDrafts);
Expand Down
Empty file.
1 change: 1 addition & 0 deletions src/code-execution/files/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("index");
1 change: 1 addition & 0 deletions src/code-execution/files/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("index.ts");
1 change: 1 addition & 0 deletions src/code-execution/files/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("This is from main")
67 changes: 67 additions & 0 deletions src/code-execution/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
lesson_name: Code execution
layout: layouts/lesson.njk
code_editor: true
code_execution: true
adding_file_allowed: true
hide_content: true
file_groups:
- common: true
id: 0
name: Common files
files:
- file_name: text.txt
file_type: plaintext
id: 423
is_closable: true
is_edit_focus: false
is_editable: true
is_hidden: false
is_main: false
is_test_file: false
source: content.txt
- common: false
files:
- file_name: main.py
file_type: python
id: 424
is_closable: false
is_edit_focus: true
is_editable: true
is_hidden: false
is_main: true
is_test_file: false
source: main.py
id: 1
name: Python
- common: false
files:
- file_name: index.js
file_type: javascript
id: 425
is_closable: false
is_edit_focus: true
is_editable: true
is_hidden: false
is_main: true
is_test_file: false
source: index.js
id: 2
name: Javascript
- common: false
files:
- file_name: index.ts
file_type: typescript
id: 426
is_closable: false
is_edit_focus: true
is_editable: true
is_hidden: false
is_main: true
is_test_file: false
source: index.ts
id: 4
name: TypeScript
---

This is a free code execution environment that allows you to run code in the browser. It's a great way to test code snippets and experiment with different programming languages.

0 comments on commit 0bd679b

Please sign in to comment.