A live demo of the jekyll-github-code plugin

{% github_code ... %}

Full File Embedding

Embed an entire file from any public GitHub repository:

{% github_code r0x0d/toolbox-dev/blob/main/toolbox/environment/fedora-packaging.Containerfile %}
FROM quay.io/toolbox-dev/default:latest

COPY hack/setup.sh /tmp/setup.sh

ENV PKGS fedpkg \
    packit \
    copr-rpmbuild \
    copr \
    rust2rpm \
    go2rpm \
    cargo2rpm \
    pyp2spec \
    tomcli \
    python3-pip \
    rubygem-gem2rpm

RUN /tmp/setup.sh

# Install nice-to-have tools for packaging
RUN python3 -m pip install --no-cache-dir \
    woolly==0.4.0 \
    fuzzytail==0.1.0 \
    cookiecutter==2.6.0 \
    # Needed for cookiecutter
    jinja2_time==0.2.0

LABEL purpose="A toolbox container for Fedora Packaging environment"

Line Range Selection

Show only specific lines with #L5-L12 syntax:

{% github_code r0x0d/toolbox-dev/blob/main/toolbox/environment/fedora-packaging.Containerfile#L5-L12 %}
ENV PKGS fedpkg \
    packit \
    copr-rpmbuild \
    copr \
    rust2rpm \
    go2rpm \
    cargo2rpm \
    pyp2spec \

Single Line

Extract just one line with #L10:

{% github_code r0x0d/toolbox-dev/blob/main/toolbox/environment/fedora-packaging.Containerfile#L1 %}
FROM quay.io/toolbox-dev/default:latest

Python Syntax Highlighting

Automatic language detection based on file extension:

{% github_code pallets/flask/blob/main/src/flask/__init__.py#L1-L20 %}
from . import json as json
from .app import Flask as Flask
from .blueprints import Blueprint as Blueprint
from .config import Config as Config
from .ctx import after_this_request as after_this_request
from .ctx import copy_current_request_context as copy_current_request_context
from .ctx import has_app_context as has_app_context
from .ctx import has_request_context as has_request_context
from .globals import current_app as current_app
from .globals import g as g
from .globals import request as request
from .globals import session as session
from .helpers import abort as abort
from .helpers import flash as flash
from .helpers import get_flashed_messages as get_flashed_messages
from .helpers import get_template_attribute as get_template_attribute
from .helpers import make_response as make_response
from .helpers import redirect as redirect
from .helpers import send_file as send_file
from .helpers import send_from_directory as send_from_directory

Using Full GitHub URLs

You can also use complete GitHub URLs:

{% github_code https://github.com/r0x0d/toolbox-dev/blob/main/toolbox/environment/fedora-packaging.Containerfile#L1-L5 %}
FROM quay.io/toolbox-dev/default:latest

COPY hack/setup.sh /tmp/setup.sh

ENV PKGS fedpkg \