Spiega documentation
- Knowledge sharing
- Portfolio
present documentation
present this documentation
The documentation is made with mardown and .org files. We need to convert those files into a public documentation.
.org files are really versatile and can export to many other formats.
- using LaTeX or postscript
- html
- with different exporting options
- html reveal
- mainly using reveal.js with reveal_custom.css
- html slides
- my custom scripts slide.js and slide.css
slides
Here we use two main libraries
- reveal
- reveal.js
- custom
reveal
There are multiple options to turn org files into reveal slides
create animations
Blender has its own scripting tab but it doesn’t fit in my workflow where I use python REPL and LLMs to test the commands.
Blender has an addon called blender-mcp which allows to access blender methods from outside.
So I need to run the mcp server with transport http:
cd ~/lav/src/blender_twin/deploy/mcp_client/
#bash ./blender_local_client.sh &
cd $HOME/lav/src/blender_twin/deploy/mcp_client/blender_mcp_example_code/mcp/blmcp/
#python3 -m blmcp
uv --directory $HOME/lav/src/blender_twin/deploy/mcp_client/blender_mcp_example_code/mcp run blender-mcp --transport http --port 9191 &
I then need a container as defined in docker_compose.yml to create a bridge between the host and the containers within docker network.
blender-mcp-bridge:image: alpine/socat:latestcontainer_name: blender-mcp-bridgenetwork_mode: "host"command: TCP-LISTEN:19191,fork,reuseaddr TCP:127.0.0.1:9191restart: unless-stopped
I can then work on a script create_animation.py or let an LLM test the blender code without exiting the container.
Mermaid produces svg files which are loaded in blender apart from text which is not recognized. For that we created a script text2svg.py to load each text tag, load a font and create a path around that text. We apply as well some grouping logic so the import in blender is smoother.
cd ~/lav/src/spiega/script/
python3 text2svg.py ~/lav/siti/f/f_twin/arch_diagram.svg
mv output.svg ~/VideoProd/in_prog/graph/arch_dia.svg
File processed: /home/sabeiro/lav/siti/f/f_twin/arch_diagram.svgresults in output.svg
voice over
To speed up voice over we use some tools like
cd ~/VideoProd/in_prog/graph/
#pip install auto-editor
auto-editor
mv output.svg ~/VideoProd/in_prog/graph/arch_dia.svg
exporting
We started with many tools and we tried to minimize the dependencies so over time I removed the dependencies from tools like `markdown` and `pandoc`. I rather use my own header and footer templates In emacs.el we define most of the configurations and load the libraries. In reveal_config.org we have the additional configurations for export.
conversion scripts
.org publish
.org files allow the publishing option as defined in emacs.el where I can set a project and the publishing directory. All the .org files in the `base-directory` will be converted into the `publishing-directory` and the pictures will be copied.
(setq org-publish-project-alist
'(("blender_twin"
:base-directory "~/lav/src/blender_twin/docs/plan/"
:publishing-directory "~/lav/siti/spiega/a/"
:publishing-function roam-publication-wrapper
:recursive t
:html-head "<link rel=\"stylesheet\" href=\"static_html//css/org.css\" type=\"text/css\"/>\n"
)
("images"
:base-directory "~/lav/src/blender_twin/docs/f/"
:base-extension "jpg\\|gif\\|png\\|svg"
:recursive t
:publishing-directory "~/lav/siti/f/"
:publishing-function org-publish-attachment)))
emacs reveal slides
Emacs has many packages to convert .org into html + reveal.js, the most common is org-reveal but I tested org-re-reveal, emacs-reveal, oer-reveal, ox-reveal and they all cause headaches.
I had to pick manually select files from reveal.js and put them in the same order in the folder reveal/ with the same relative paths.
I tend to prefer `org-reveal` which has least dependencies.
TODO export file
I need to figure out how to change filename (add _slide) and how to move it to another directory
script
We use one command to export this file to reveal.js and move it to the final folder.
(org-reveal-export-to-html)
;;(org-re-reveal-export-to-html)
documentation_present.html
mv documentation_present.html ~/lav/siti/spiega/a/documentation_present_slide.html
#firefox http://localhost/spiega/a/documentation_present_slide.html
TODO oer package
Here we test the oer package
(use-package oer-reveal-publish)
(oer-reveal-setup-submodules t)
(oer-reveal-generate-include-files t)
(oer-reveal-publish-setq-defaults)
(setq oer-reveal-publish-babel-languages '((dot . t) (emacs-lisp . t))
org-publish-project-alist
(list (list "img"
:base-directory "~/lav/siti/blender_twin/"
:base-extension "png"
:publishing-function 'org-publish-attachment
:publishing-directory "~/lav/siti/f/f_twin/")))
| img | :base-directory | ~/lav/siti/blender_twin/ | :base-extension | png | :publishing-function | org-publish-attachment | :publishing-directory | ~/lav/siti/f/f_twin/ |
wrap in tags
(use-package wrap-region)
(wrap-region-add-wrapper "<div class=\"r-stack\">" "</div>")
(lambda (arg) (interactive p) (wrap-region-trigger arg <div class=“r-stack”>))
convert folder
We mainly use following script to convert the documentation.
(org-publish-current-project)
#rm ~/lav/siti/spiega/a/*
cd $HOME/lav/src/spiega
bash ./script/convert.sh
### markdown/admin_tool.org ### markdown/blender_tricks.org ### markdown/documentation_present.org ### markdown/hobby_profession.org ### markdown/personal_finance.org ### markdown/second_hand.org ### markdown/spiega.org