Github's web markdown viewer supports README.org files, but its feature list is lacking compared to README.md files.
This precommit script tries to reconcile that, by converting org files to markdown file.
A fork of jeffkreeftmeijer/readme.el as a portable git hook to avoid including unnecessary submodules in your repos
-
Adds support for Github Flavored Markdown's alerts.
Turning:
#+begin_note
This is a note
#+end_note
Into:
Note
This is a note
For all GFM alert styles.
(NOTE, TIP, WARNING, CAUTION, IMPORTANT)
- Adds support for
org's results blocks as<details>html code that is rendered nicely by Github For example
cowsay "That's pretty neat!"Results
_____________________
< That's pretty neat! >
---------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
It assumes you have emacs installed.
This feels like a fairly safe assumption if you are editing org files.
You can use this tool in two ways:
Install with the following curl command:
Warning
Always inspect scripts you intend to run on your computer. Do not trust me.
curl -fsSL "https://raw.githubusercontent.com/aidanprior/org-to-gfm-readme-md/refs/heads/main/install.sh" | sh➡️ Fetching pinned elisp…
✅ Installed:
- .githooks/org-to-gfm.el (ox-gfm @ bd85f6a, ox-md-title @ 0.3.0)
- .githooks/pre-commit
Git configured: core.hooksPath -> .githooks
Manual git hooks installation complete!
Next (for manual git hooks):
git add .githooks/org-to-gfm.el .githooks/pre-commit
git commit -m 'chore: installed org→gfm pre-commit'
# Test: edit & stage an .org file, then 'git commit'
Alternative: Use with pre-commit framework
Instead of the above, you can use this with the pre-commit framework:
1. Install pre-commit: pip install pre-commit
2. Create .pre-commit-config.yaml with:
repos:
- repo: https://github.com/aidanprior/org-to-gfm-readme-md
rev: main
hooks:
- id: org-to-gfm
3. Run: pre-commit install
4. The elisp file (.githooks/org-to-gfm.el) is still needed for pre-commit framework.
As you can see, it creates the pre-commit script files, and configures git to use them. From there, follow the next steps. Commit org files, and watch them convert automatically
If you prefer using the pre-commit framework, you can use this hook without running the install script:
-
Install pre-commit:
pip install pre-commit
-
First, you still need the elisp dependencies. Run just the elisp setup:
curl -fsSL "https://raw.githubusercontent.com/aidanprior/org-to-gfm-readme-md/refs/heads/main/install.sh" | sh -s -- --elisp-only
-
Create
.pre-commit-config.yamlin your repository:repos: - repo: https://github.com/aidanprior/org-to-gfm-readme-md rev: main # or use a specific tag/commit hooks: - id: org-to-gfm
-
Install the pre-commit hook:
pre-commit install
-
Test it:
# Edit an .org file, stage it, and commit git add README.org git commit -m "test conversion"
The pre-commit framework approach gives you better control over hook execution and integrates well with other code quality tools.
-
Manual Git Hooks (Option 1):
- ✅ Simple, standalone solution
- ✅ No additional Python dependencies
- ✅ Works immediately after running install.sh
- ❌ Less integration with modern development workflows
- ❌ Harder to manage multiple hooks
-
Pre-commit Framework (Option 2):
- ✅ Better integration with modern development workflows
- ✅ Easy to manage multiple hooks and formatting tools
- ✅ Supports hook versioning and updates
- ✅ Can run hooks on CI/CD systems
- ❌ Requires Python and pre-commit installation
- ❌ Slightly more complex setup
Both options use the same core conversion logic and produce identical results.
If you encounter any bugs, please use the issues tab. If you can fix them yourself, please still create an issue and then a pull request that mentions it