Org mode demo
Demo to show how various Org mode blocks are rendered.
This test post shows the blog and Org mode features.
Code blocks
Source highlighting is done by Emacs at build time (with htmlize). Move the mouse over a block to see the copy button.
from pathlib import Path
for post in sorted(Path("posts").glob("*.org")):
print(post.stem)
2026-09-25-hello
(defun blog-hello (name)
"Return a greeting for NAME."
(format "Hello, %s!" name))
make serve
Inline code also works: make rebuild.
Images
Links to local image files are rendered as images on the page.
Video
A video: link is rendered as an HTML5 video player. The path can be a local file or a URL.
A section can be initially folded  folded
The :folded: tag on the heading makes the section folded on page load.
A link to a heading inside this section opens it: go to the nested section.
Nested section
Nested sections fold too.
Tables and quotes
| Feature | Where it is implemented |
|---|---|
| Folding | static/blog.js |
| Code | htmlize |
| Video | publish.el |
Everything is text, and that is powerful.
Config preview (custom)
The custom popup is implemented in a separate JavaScript file that can be included like this:
#+HTML_HEAD_EXTRA: <script defer src="/static/config-preview.js"></script> [[file:files/cwl-setup.config][cwl-setup.config, click to preview in popup]]
Here is a live example: cwl-setup.config, click to preview in popup
The file can also be displayed in the HTML <details> tag:
cwl-setup.config (download)
########################################################################
##
########################################################################
Conditions:
SNSTopicExists : { "Fn::Not" : [{ "Fn::Equals" : [ "", {"Fn::FindInMap" : ["AWSEBOptions", "options", "EBSNSTopicArn"]}]}]}
Outputs:
ElasticBeanstalkSNSTopicArn:
Description: "The SNS Topic ARN for Elastic Beanstalk event notifications. Empty string if none specified."
Value: { "Fn::FindInMap": ["AWSEBOptions", "options", "EBSNSTopicArn"] }
Resources:
AWSEBAutoScalingGroup:
Metadata:
"AWS::CloudFormation::Init":
configSets:
"_OnInstanceBoot":
"CmpFn::Insert":
values:
- CWLogsAgentClearConfig
- CWLogsAgentConfigSetup
- CWLogsAgentUpdaterInstallation
- CWLogsAgentInstallation
"CWLogsAgentInstallation":
- CWLogsAgentClearConfig
- CWLogsAgentConfigSetup
- CWLogsAgentUpdaterInstallation
- CWLogsAgentInstallation
"CWLogsAgentConfigUpdate":
- CWLogsAgentClearConfig
- CWLogsAgentConfigSetup
- CWLogsAgentUpdateConfig
CWLogsAgentClearConfig:
commands:
01-clear-agent-config:
command: rm -rf /tmp/cwlogs/conf.d
CWLogsAgentConfigSetup:
files:
"/tmp/cwlogs/conf.d/general.conf":
content : |
[general]
state_file = /var/awslogs/state/agent-state
mode : "000400"
owner : root
group : root
commands:
01-setup-agent-config:
## Every .conf file in /tmp/cwlogs/conf.d/ will be concatenated together to form the cwl agent config file
command: |
cat /tmp/cwlogs/conf.d/*.conf > /tmp/cwlogs/cwlogs-config.conf
CWLogsAgentInstallation:
files:
"/tmp/cwlogs/awslogs-agent-setup.py" :
source : "https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py"
mode : "000700"
owner : root
group : root
commands:
01-setup-cwlogs-agent:
## Install the cwlogs agent - this will also install the cli it needs (in a virtualenv)
command: |
setsid /tmp/cwlogs/awslogs-agent-setup.py -n -r `{"Ref" : "AWS::Region" }` -c /tmp/cwlogs/cwlogs-config.conf && exit 0;
## Configuration deployment command - update agent if needed
CWLogsAgentUpdaterInstallation:
files:
"/opt/elasticbeanstalk/hooks/configdeploy/enact/00_update_cwlogs_agent.sh":
content: |
#!/bin/bash
. /etc/elasticbeanstalk/.aws-eb-stack.properties
/opt/aws/bin/cfn-init -v -s "$stack_name" -r "$resource" --region "$region" --configsets CWLogsAgentConfigUpdate > /var/log/eb-cfn-init-call.log 2>&1
mode : "000700"
owner : root
group : root
CWLogsAgentUpdateConfig:
files:
"/tmp/cwlogs/bin/cwlogs-update.sh":
content: |
#!/bin/bash
log() {
echo [$(date -u +"%Y-%m-%d %TZ")] $1
}
log "Executing cwlogs agent configuration update"
if cmp /var/awslogs/etc/awslogs.conf /tmp/cwlogs/cwlogs-config.conf > /dev/null 2>&1; then
log "Configuration has not changed - not updating"
exit 0;
fi
log "Copying new cwlogs config to /var/awslogs/etc/awslogs.conf"
cp /tmp/cwlogs/cwlogs-config.conf /var/awslogs/etc/awslogs.conf;
log "Restarting awslogs service"
service awslogs restart;
log "awslogs service restart complete"
log "Completed cwlogs agent configuration update"
exit 0;
mode : "000700"
owner : root
group : root
commands:
01-update-agent-config:
command: "/tmp/cwlogs/bin/cwlogs-update.sh >> /var/log/eb-cwlogs.log 2>&1"
## Version deployment command - ensure agent is installed
files:
"/tmp/cwlogs/bin/cwlogs-install.sh":
content: |
#!/bin/bash
log() {
echo [$(date -u +"%Y-%m-%d %TZ")] $1
}
log "Initiating cwlogs agent installation/update"
. /etc/elasticbeanstalk/.aws-eb-stack.properties
CONFIG_SET=CWLogsAgentInstallation
## just do an update if we think it's already installed
if [ -f "/var/awslogs/etc/awslogs.conf" ]; then
CONFIG_SET=CWLogsAgentConfigUpdate
log "Running agent configuration update"
else
log "Running agent installation"
fi
/opt/aws/bin/cfn-init -v -s "$stack_name" -r "$resource" --region "$region" --configsets $CONFIG_SET;
log "Completed cwlogs agent installation/update"
exit 0;
mode : "000700"
owner : root
group : root
commands:
01-ensure-agent-installation:
command: "/tmp/cwlogs/bin/cwlogs-install.sh >> /var/log/eb-cwlogs.log 2>&1"
HTML Export
The #+begin_export html and #+end_export lines allow inserting HTML snippets that
will be added to the HTML after org export:
#+begin_export html
<div class="demo-popup">
<div class="close">close</div>
<div class="download"><a href="">Download (<span class="name"></span>)</a></div>
<div class="popup-content"></div>
</div>
<style type="text/css">
.demo-popup { display: none; }
</style>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
console.log("The DOM is fully parsed and ready!");
// document.addEventListener("click", () => {
// document.querySelector('.demo-popup').style.display = 'block'
// });
});
</script>
#+end_export