Skip to content

Commit 7533349

Browse files
Merge pull request #325 from GuentherJulian/feature/copyImages
copy images folder to output directory
2 parents 6d6acb8 + a2668d7 commit 7533349

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

documentation/Structure.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
|-- tutorials
1212
|-- [playbook-name]
1313
/--index.asciidoc
14+
|-- images
15+
/--image.jpg
16+
1417

15-
Write your own tutorials in "./tutorials/[playbook-name]/index.asciidoc".
18+
19+
Write your own tutorials in "./tutorials/[playbook-name]/index.asciidoc". Images must be saved in a folder called `images`.
1620
You will find all the details in the tutorials [Developement](https://github.com/devonfw-tutorials/tutorials/wiki/Development) page.
1721

1822

documentation/Tutorials.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ functionName2(parameters)
9494
--
9595
```
9696

97+
To display images within a step, you can use either the [displayContent](https://github.com/devonfw-tutorials/tutorial-compiler/wiki/Functions#displayContent) function or the following syntax in the index.asciidoc file:
98+
```
99+
![alternative text](./assets/image.jpg)
100+
```
101+
The image must be in a folder called `images` in the folder of the playbook (see [Structure](https://github.com/devonfw-tutorials/tutorial-compiler/wiki/Structure)).
102+
97103
You can also add an optional conclusion text, which is shown on completion of the tutorial. Use this to summarize the important content of the tutorial, to point out what to learn next or to mention other useful informations.
98104

99105
To do that, you have to provide the conclusion at the end of the tutorial (after the last step) surrounded by ```====```.
@@ -115,6 +121,7 @@ Description of the tutorial
115121
====
116122
117123
The explanation for the step 1
124+
![alternative text](./assets/image.jpg)
118125
[step]
119126
--
120127
functionName1(parameters)

runners/katacoda/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export class Katacoda extends Runner {
7373
this.createFolder(path.join(this.outputPathTutorial, "assets", "setup"), true);
7474
this.writeSetupFile(path.join(this.outputPathTutorial, "assets", "setup", "setup.txt"))
7575

76+
let imageDirectory = path.join(this.playbookPath, "images");
77+
if(fs.existsSync(imageDirectory)) {
78+
this.assetManager.registerDirectory(imageDirectory, "", "", true);
79+
}
80+
7681
// copy all assets from temp/setup in assets folder
7782
this.assetManager.registerDirectory(path.join(this.tempPathTutorial, "setup"), "setup", "/root/setup", true);
7883
this.assetManager.copyAssets();
@@ -355,7 +360,6 @@ export class Katacoda extends Runner {
355360
fs.appendFileSync(tempFile, fs.readFileSync(path.join(this.playbookPath, param.file), "utf-8"));
356361
} else if (param.image) {
357362
let image = path.join(this.playbookPath, param.image);
358-
this.assetManager.registerFile(image, path.basename(image), "", true);
359363
fs.appendFileSync(tempFile, "![" + path.basename(image) + "](./assets/" + path.basename(image) + ")");
360364
}
361365
fs.appendFileSync(tempFile, "\n\n");

0 commit comments

Comments
 (0)