Skip to content

Instantly share code, notes, and snippets.

View invisibleroads's full-sized avatar

Roy Hyunjin Han invisibleroads

View GitHub Profile
@glombard
glombard / reference-markdown-metadata-from-jinja-template.py
Last active May 30, 2023 09:19
How to use Markdown as a filter in a Jinja2 template, and then extract the Markdown Meta property directly from the template. Assuming you want to use the Meta-data value before rendering the converted Markdown content (e.g. in the html head), the trick is to render the markdown first, save it to a variable (html_content in this example) using a…
from pprint import pprint
import jinja2
import markdown
HTML_TEMPLATE = """{% macro get_html() %}
{{ content | markdown }}
{% endmacro %}
{% set html_content = get_html() %}
Title from Markdown meta-data: {{ get_title() }}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 8, 2024 17:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname