Skip to content

Commit

Permalink
Only render run button when runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
shaedrich authored Jun 6, 2024
1 parent f738e31 commit aba7756
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ __Does the name of the file matter?__ Not to the compiler, no. Pony doesn't care

In your file, put the following code:

```{ .ponylang snippet="hello-world-main.pony" dedent_subsections=false }
```{ .ponylang snippet="hello-world-main.pony" dedent_subsections=false runnable=false }
Gibberish
```

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Let's go through that line by line.

## Line 1

```{ .ponylang snippet="classes-wombat.pony:1-3,6" dedent_subsections=false }
```{ .ponylang snippet="classes-wombat.pony:1-3,6" dedent_subsections=false runnable=true }
Lorem ipsum
```

Expand Down
6 changes: 3 additions & 3 deletions lib/superfences_ponylang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ def format(source, language, css_class, options, md, classes=None, id_value='',
except:
raise SuperFencesException('Could not highlight source code "%s" passed' % (source))

return """
return f"""
<pre>
<nav class="md-code__nav">
<button class="md-code__button" title="Copy to clipboard" data-clipboard-target="#__code_1 &gt; code" data-md-type="copy"></button>
<button class="md-code__button" title="Run in playground" data-md-type="run"></button>
<button class="md-code__button" title="Run in playground" data-md-type="inline"></button>
{'<button class="md-code__button" title="Run in playground" data-md-type="run"></button>' if attrs.get('runnable', false) else ''}
{'<button class="md-code__button" title="Run in playground" data-md-type="inline"></button>' if attrs.get('runnable', false) else ''}
</nav>
<code lang="pony">%s</code>
</pre>
Expand Down

0 comments on commit aba7756

Please sign in to comment.