Tear out almost everything, add /readme endpoint
author |
Steve Losh <steve@stevelosh.com> |
date |
Wed, 15 Jan 2020 18:38:21 -0500 |
parents |
(none) |
children |
(none) |
hgext.README
============
A fork of <https://www.mercurial-scm.org/wiki/MarkdownExtension> that tears out
most of its guts and just adds a single thing: a `/readme` endpoint that will
display the repository's `README`. If the `README` ends with `.md` or
`.markdown` it will be rendered with `python-markdown`, otherwise it will just
display the raw text in a `<pre>`.
Usage
-----
1. Install [`python-markdown`](http://packages.python.org/Markdown/install.html).
2. Clone this repository to `/example/hgext.readme`
3. Add the following to your hgweb config:
[extensions]
hgext.readme=/example/hgext.readme
[web]
# optional; 'tip' is default value.
markdown.changeid = tip
4. Create a `readme` template in whatever templates directory you're using and
install it in the `map` file (e.g. `readme = readme.tmpl`).
5. Create the `readme.tmpl` and make it look like you want. Inside the
template, `{readme_content}` will contain the HTML of the README.
6. Optional: update the `default` in `map` to make `readme` the endpoint served at `/`.
Security
--------
This extension enables users with commit/push access to the repos to create
arbitrary html content that may be browsed by other users. At this time no
attempt has been made to detect or prevent attacks such as cross-site scripting
(xss) and other types of attacks. In general this extension should only be used
if you trust all users with push access.