@@ -8,6 +8,10 @@ This page tests the include app functionality for including source files with va
88
99Include a Python file with automatic language detection:
1010
11+ <!-- {% embed include file="src/samples/hello.py" %} -->
12+
13+ <div data-embedify data-app =" include " data-option-file =" src/samples/hello.py " style =" display :none " ></div >
14+
1115``` python
1216# !/usr/bin/env python3
1317
@@ -31,6 +35,10 @@ if __name__ == "__main__":
3135
3236Include a JavaScript file with automatic language detection:
3337
38+ <!-- {% embed include file="src/samples/fibonacci.js" %} -->
39+
40+ <div data-embedify data-app =" include " data-option-file =" src/samples/fibonacci.js " style =" display :none " ></div >
41+
3442``` javascript
3543function fibonacci (n ) {
3644 if (n <= 1 ) {
@@ -54,6 +62,10 @@ console.log(generateSequence(10));
5462
5563Include a JSON file with automatic language detection:
5664
65+ <!-- {% embed include file="src/samples/package.json" %} -->
66+
67+ <div data-embedify data-app =" include " data-option-file =" src/samples/package.json " style =" display :none " ></div >
68+
5769``` json
5870{
5971 "name" : " test-project" ,
@@ -82,6 +94,10 @@ Include a JSON file with automatic language detection:
8294
8395Include only the first 5 lines of the Python file:
8496
97+ <!-- {% embed include file="src/samples/hello.py" range="-5" %} -->
98+
99+ <div data-embedify data-app =" include " data-option-file =" src/samples/hello.py " data-option-range =" -5 " style =" display :none " ></div >
100+
85101``` python
86102# !/usr/bin/env python3
87103
@@ -94,6 +110,10 @@ def greet(name):
94110
95111Include lines 3 through 8 of the JavaScript file:
96112
113+ <!-- {% embed include file="src/samples/fibonacci.js" range="3-8" %} -->
114+
115+ <div data-embedify data-app =" include " data-option-file =" src/samples/fibonacci.js " data-option-range =" 3-8 " style =" display :none " ></div >
116+
97117``` javascript
98118 return n;
99119 }
@@ -107,6 +127,10 @@ function generateSequence(length) {
107127
108128Include from line 10 to the end of the JavaScript file:
109129
130+ <!-- {% embed include file="src/samples/fibonacci.js" range="10-" %} -->
131+
132+ <div data-embedify data-app="include" data-option-file="src/samples/fibonacci.js" data-option-range="10-" style="display:none"></div>
133+
110134` ` ` javascript
111135 for (let i = 0 ; i < length; i++ ) {
112136 sequence .push (fibonacci (i));
@@ -121,6 +145,10 @@ console.log(generateSequence(10));
121145
122146Include only line 1 of the Python file:
123147
148+ <!-- {% embed include file="src/samples/hello.py" range="1-1" %} -->
149+
150+ <div data-embedify data-app =" include " data-option-file =" src/samples/hello.py " data-option-range =" 1-1 " style =" display :none " ></div >
151+
124152``` python
125153# !/usr/bin/env python3
126154```
@@ -131,6 +159,10 @@ Include only line 1 of the Python file:
131159
132160Include Python file but override language to text:
133161
162+ <!-- {% embed include file="src/samples/hello.py" lang="text" %} -->
163+
164+ <div data-embedify data-app =" include " data-option-file =" src/samples/hello.py " data-option-lang =" text " style =" display :none " ></div >
165+
134166``` text
135167#!/usr/bin/env python3
136168
@@ -154,6 +186,10 @@ if __name__ == "__main__":
154186
155187Include JSON file but override language to JavaScript:
156188
189+ <!-- {% embed include file="src/samples/package.json" lang="javascript" %} -->
190+
191+ <div data-embedify data-app =" include " data-option-file =" src/samples/package.json " data-option-lang =" javascript " style =" display :none " ></div >
192+
157193``` javascript
158194{
159195 " name" : " test-project" ,
@@ -182,6 +218,10 @@ Include JSON file but override language to JavaScript:
182218
183219Include markdown file as raw content (not wrapped in code block):
184220
221+ <!-- {% embed include file="src/samples/config.md" type="raw" %} -->
222+
223+ <div data-embedify data-app =" include " data-option-file =" src/samples/config.md " data-option-type =" raw " style =" display :none " ></div >
224+
185225# Sample Configuration
186226
187227This is a sample configuration file for testing include functionality.
@@ -208,6 +248,10 @@ This is a sample configuration file for testing include functionality.
208248
209249Include lines 3-6 of Python file as raw content:
210250
251+ <!-- {% embed include file="src/samples/hello.py" range="3-6" type="raw" %} -->
252+
253+ <div data-embedify data-app =" include " data-option-file =" src/samples/hello.py " data-option-range =" 3-6 " data-option-type =" raw " style =" display :none " ></div >
254+
211255
212256def greet(name):
213257 """Greet someone with a hello message."""
@@ -219,6 +263,10 @@ def greet(name):
219263
220264Include lines 1-3 of JavaScript file with Python syntax highlighting:
221265
266+ <!-- {% embed include file="src/samples/fibonacci.js" range="1-3" lang="python" %} -->
267+
268+ <div data-embedify data-app =" include " data-option-file =" src/samples/fibonacci.js " data-option-range =" 1-3 " data-option-lang =" python " style =" display :none " ></div >
269+
222270``` python
223271function fibonacci(n) {
224272 if (n <= 1 ) {
@@ -229,6 +277,10 @@ function fibonacci(n) {
229277
230278Include lines 2 - 4 of JSON file as raw content:
231279
280+ < !-- {% embed include file =" src/samples/package.json" range =" 2-4" type =" raw" % } -- >
281+
282+ < div data- embedify data- app=" include" data- option- file =" src/samples/package.json" data- option- range =" 2-4" data- option- type =" raw" style=" display:none" >< / div>
283+
232284 " name" : " test-project" ,
233285 " version" : " 1.0.0" ,
234286 " description" : " A test project for include functionality" ,
@@ -237,6 +289,10 @@ Include lines 2-4 of JSON file as raw content:
237289
238290Include lines 5 - 10 of Python file as raw content with language override:
239291
292+ < !-- {% embed include file =" src/samples/hello.py" range =" 5-10" lang=" bash" type =" raw" % } -- >
293+
294+ < div data- embedify data- app=" include" data- option- file =" src/samples/hello.py" data- option- range =" 5-10" data- option- lang=" bash" data- option- type =" raw" style=" display:none" >< / div>
295+
240296 """ Greet someone with a hello message."""
241297 return f " Hello, { name} ! "
242298
@@ -250,6 +306,10 @@ def main():
250306
251307Test empty range defaults to full file :
252308
309+ < !-- {% embed include file =" src/samples/hello.py" range =" " % } -- >
310+
311+ < div data- embedify data- app=" include" data- option- file =" src/samples/hello.py" data- option- range =" " style=" display:none" >< / div>
312+
253313```python
254314# !/usr/bin/env python3
255315
@@ -273,6 +333,10 @@ if __name__ == "__main__":
273333
274334Test invalid range defaults to full file :
275335
336+ < !-- {% embed include file =" src/samples/hello.py" range =" invalid-range" % } -- >
337+
338+ < div data- embedify data- app=" include" data- option- file =" src/samples/hello.py" data- option- range =" invalid-range" style=" display:none" >< / div>
339+
276340```python
277341# !/usr/bin/env python3
278342
@@ -296,6 +360,10 @@ if __name__ == "__main__":
296360
297361Test range that goes beyond file length:
298362
363+ < !-- {% embed include file =" src/samples/hello.py" range =" 1-1000" % } -- >
364+
365+ < div data- embedify data- app=" include" data- option- file =" src/samples/hello.py" data- option- range =" 1-1000" style=" display:none" >< / div>
366+
299367```python
300368# !/usr/bin/env python3
301369
0 commit comments