Skip to content

Commit

Permalink
some minor doc fixes
Browse files Browse the repository at this point in the history
add a proper documentation of the render-pipeline
  • Loading branch information
guFalcon committed Jan 10, 2025
1 parent cf5d9d5 commit 5cac725
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ So there are some intricacies you should be aware of when working with it and se
Here you can find the technical intricacies of the Obsidian-specific language extension implemented in this project [docs](docs-obsidian.md).
## Permissions
You can specify who is able to read whole files, or only parts of it.
Here you can find more information about [docs-permissions](permissions).
Here you can find more information about [permissions](docs-permissions).
## Technical Details
If you're interested about the software used behind the scenes or some of the URLs you may use to do stuff, then look [here](docs-technical-details).
## Development: Building this Project
Expand Down
2 changes: 1 addition & 1 deletion docs-building.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Building
If you'd like to build and install your own instance of this project, you've come to the right page.

[back](README.md) to the main page.
[Back](README.md) to the main page.
## How To Build / Update
The repository derives from https://github.com/htl-leonding-college/asciidoctor-docker-template and adds functionality to publish the output to a web-server of your liking using DockerHub.
It hides (server-side) all pages behind a OIDC token redirecting to an authentication server of your liking (in the default-case it's client on a Keycloak instance linked to our school's AD service, so we never have to maintain the users because the school does this for us).
Expand Down
2 changes: 1 addition & 1 deletion docs-debugging.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# # Debugging
Here you can find help with debugging the project.

[back](README.md) to the main page.
[Back](README.md) to the main page.
## Debugging
To test the portions of the web-site that isn't directly connected to the gh-pages generation and Asciidoc conversion, you may want to start it using VSCode.
Just do the following:
Expand Down
2 changes: 1 addition & 1 deletion docs-keycloak.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Here you find information about the keycloak-setup when you're trying to host it yourself.

[back](README.md) to the main page.
[Back](README.md) to the main page.
## Keycloak Setup
In order for this setup to work correctly, you'll have to have a Keycloak-client (private with secret) and standard-authorization-flow enabled (should be enabled anyway).
You need the following user-attributes of type `string` with mapper to the token.
Expand Down
2 changes: 1 addition & 1 deletion docs-obsidian.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Obsidian Extensions
Here you can find the technical intricacies of the Obsidian-specific language extension.

[back](README.md) to the main page.
[Back](README.md) to the main page.
## Globally Unique File Names
Obsidian uses quick-links like so:
```markdown
Expand Down
2 changes: 1 addition & 1 deletion docs-permissions.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Permissions
Here you can find an explanation of the projects permissions-features.

[back](README.md) to the main page.
[Back](README.md) to the main page.
## Security
To restrict the visibility of a whole file or parts of a document's content and therefore effectively hiding it from anyone not having any of the given roles assigned, you specify a comma-separated list of roles.
Anyone who has even one of these roles assigned will be able to view the document or that part of the document you specified the directive for.
Expand Down
22 changes: 20 additions & 2 deletions docs-technical-details.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Here you find in-depth information about some of the technical background behind the scenes.

[back](README.md) to the main page.
[Back](README.md) to the main page.
## MD-File Conversion
This is done using [marked](https://www.npmjs.com/package/marked) which is installed on the web-server (via `package.json`).
With the help of this you can link to any MD-file and show it in the context of your site.
Expand Down Expand Up @@ -72,4 +72,22 @@ You can now add the parameter `print-pdf` to the path-string like so:
```bash
https://safelearn.unterrainer.info/md/presentations/test-presentation.md?reveal=true&print-pdf
```
This then renders your RevealJS presentation as a continuous page that you may print as PDF or on whatever printer you have currently installed.
This then renders your RevealJS presentation as a continuous page that you may print as PDF or on whatever printer you have currently installed.
## Render-Pipeline
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.

1. File is loaded from disk (`app.js`)
2. Accesstoken is refreshed, so it and all contained roles and attributes are actually current
3. `preParse` is called preparing the content for HTML-conversion
1. `removeForbiddenContent` parses for file- and inline-permissions and removes forbidden parts of the file
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
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)
4. `preReplaceObsidianFileLinks` replaces Obsidian- (or Wiki-) style links with proper links your browser can understand
5. `preMarkCallouts` parses for callouts (may be nested) and replaces their tags inline with appropriate start- and end-tags of our own
6. `unmarkCode` replaces the code-marks by the content of the previously saved array
4. `manipulateHtml` is called actually converting the file
1. `replacePreMarkCallouts` renders the proper callouts pre-marked earlier on
2. `replaceObsidianImageLinks` deals with the Obsidian- (or Wiki-) specific image links (shortform) by expanding that into a proper image-tag
3. `replaceObsidianImageLatResizeValues` deals with the conditional image resizing described in the Obsidian-specific document [here](docs-obsidian)
4. `makeContentMap` generates the map of the files' content later on displayed on the left navbar
5. `DOMPurify.santitize` is called before sending the response to the client

0 comments on commit 5cac725

Please sign in to comment.