Skip to content

Instantly share code, notes, and snippets.

@miketheman
Last active July 13, 2022 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miketheman/ea99f1ef40073220648d0a75cbdd787a to your computer and use it in GitHub Desktop.
Save miketheman/ea99f1ef40073220648d0a75cbdd787a to your computer and use it in GitHub Desktop.

Tests how GitHub renders code blocks

Code fence, no language set

    ```
    echo "foo"
    ```
echo "foo"

GitHub's rendered HTML output:

<pre><code>echo "foo"
</code></pre>

Code fence, language provided

    ```python
    from sys import version
    ```
from sys import version

GitHub's rendered HTML output:

<div class="highlight highlight-source-python"><pre class="rgh-observing-whitespace"><span class="pl-k">from</span> <span class="pl-s1">sys</span> <span class="pl-k">import</span> <span class="pl-s1">version</span></pre></div>

HTML pre block, with language

    <pre lang="python">
    from os import listdir
    </pre>
from os import listdir

GitHub's rendered HTML output:

<div class="highlight highlight-source-python"><pre class="rgh-observing-whitespace"><span class="pl-k">from</span> <span class="pl-s1">os</span> <span class="pl-k">import</span> <span class="pl-s1">listdir</span></pre></div>

Code fence, unknown language set

    ```abc
    echo "foo"
    ```
echo "foo"

GitHub's rendered HTML output:

<pre lang="abc" class="notranslate"><code class="notranslate">echo "foo"
</code></pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment