Code Includer

The include_code filter provides a function that can make a code sample from a file, pulling in just specific lines if desired.

Call it like so:

{{ include_code("sample_include.json", lines="1,3,5-6", mark_disjoint=True) }}

Sample:

{"line one": "here",
...
"third line": 3,
...
    "line 5": "FIVE",
"six": 6

One range:

"second line": true,
"third line": 3,
    "4th line": [1,2,3,4],

The whole file:

{"line one": "here",
"second line": true,
"third line": 3,
    "4th line": [1,2,3,4],
    "line 5": "FIVE",
"six": 6
}

Custom separator string for disjoint lines:

{"line one": "here",
"second line": true,
... (line omitted)...
    "4th line": [1,2,3,4],
    "line 5": "FIVE",
"six": 6
}