|
1 | 1 | Here you find in-depth information about some of the technical background behind the scenes. |
2 | 2 |
|
3 | | -[back](README.md) to the main page. |
| 3 | +[Back](README.md) to the main page. |
4 | 4 | ## MD-File Conversion |
5 | 5 | This is done using [marked](https://www.npmjs.com/package/marked) which is installed on the web-server (via `package.json`). |
6 | 6 | With the help of this you can link to any MD-file and show it in the context of your site. |
@@ -72,4 +72,22 @@ You can now add the parameter `print-pdf` to the path-string like so: |
72 | 72 | ```bash |
73 | 73 | https://safelearn.unterrainer.info/md/presentations/test-presentation.md?reveal=true&print-pdf |
74 | 74 | ``` |
75 | | -This then renders your RevealJS presentation as a continuous page that you may print as PDF or on whatever printer you have currently installed. |
| 75 | +This then renders your RevealJS presentation as a continuous page that you may print as PDF or on whatever printer you have currently installed. |
| 76 | +## Render-Pipeline |
| 77 | +When you have a look inside the code, you'll find that the file `obsidian.js` prepares a page in a very particular way before it is rendered to HTML-output. Here I want to document that pipeline. |
| 78 | + |
| 79 | +1. File is loaded from disk (`app.js`) |
| 80 | +2. Accesstoken is refreshed, so it and all contained roles and attributes are actually current |
| 81 | +3. `preParse` is called preparing the content for HTML-conversion |
| 82 | + 1. `removeForbiddenContent` parses for file- and inline-permissions and removes forbidden parts of the file |
| 83 | + 2. `preReplacePlantUml` replaces the code tags containing PlantUML-code with a rendered version of it by calling a proper PlantUML conversion service and inserting the SVG of that output here instead of the code-tags |
| 84 | + 3. `preMarkCode` parses the file for code-marks (cannot be nested) and replaces them for later use of the marks (the content of the code-tags parsed is saved in an array for later insertion) |
| 85 | + 4. `preReplaceObsidianFileLinks` replaces Obsidian- (or Wiki-) style links with proper links your browser can understand |
| 86 | + 5. `preMarkCallouts` parses for callouts (may be nested) and replaces their tags inline with appropriate start- and end-tags of our own |
| 87 | + 6. `unmarkCode` replaces the code-marks by the content of the previously saved array |
| 88 | +4. `manipulateHtml` is called actually converting the file |
| 89 | + 1. `replacePreMarkCallouts` renders the proper callouts pre-marked earlier on |
| 90 | + 2. `replaceObsidianImageLinks` deals with the Obsidian- (or Wiki-) specific image links (shortform) by expanding that into a proper image-tag |
| 91 | + 3. `replaceObsidianImageLatResizeValues` deals with the conditional image resizing described in the Obsidian-specific document [here](docs-obsidian) |
| 92 | + 4. `makeContentMap` generates the map of the files' content later on displayed on the left navbar |
| 93 | +5. `DOMPurify.santitize` is called before sending the response to the client |
0 commit comments