Pelican Git is a library that makes it easy to embed GitHub files in your Pelican blogs using simple syntax.
To install pelican-git
, simply use pip
:
$ pip install pelican-git
Then add a bit of code to your pelican
configuration file:
PLUGINS = [
# ...
'pelican_git',
# ...
]
In your articles, add lines to your posts that look like:
[git:repo=yourname/yourrepo,file=somefile,branch=master,hash=xxxxxxx]
branch
and hash
are optional. If you don't specify branch
, it will be master
. If you specify hash
it will overwrite the branch
setting.
The generated code will embed css
and html
content directly into a div
and replace the original tag. This is faster and cleaner than using javascript
to rewrite the page content like what gist_it does.
GIT_CACHE_ENABLED
- Specifies whether to cache the git files on disk or not. Default is False
. (Optional)
$ make install
$ make test
Inspired by pelican_gist
- Fixed error when fetching github HTML
- Support Python 3.6
- Fix link to original repo
- Initial version
Uses the MIT license.