# mdbook-open-git-repo
[![Latest version](https://img.shields.io/crates/v/mdbook-open-git-repo.svg)](https://crates.io/crates/mdbook-open-git-repo)
![License](https://img.shields.io/crates/l/mdbook-open-git-repo.svg)
[![Build Status](https://travis-ci.org/wonderfulspam/mdbook-open-git-repo.svg?branch=master)](https://travis-ci.org/wonderfulspam/mdbook-open-git-repo)
A preprocessor for [mdbook][] to add an edit link on every page. Forked and adapted from
[mdbook-open-on-gh][] to add support for other platforms than github.com such as a
self-hosted GitLab instance.
[mdbook]: https://github.com/rust-lang/mdBook
[mdbook-open-on-gh]: https://github.com/badboy/mdbook-open-on-gh
It adds a customisable link (default: "Edit this file on GitHub.") on the bottom
of every page, linking directly to the source file. It uses the configured
`git-repository-url` as the base.
## Installation
Install using Cargo or grab a binary from the release page and place it
somewhere in your `$PATH`.
Add it as a preprocessor to your `book.toml`:
```
[preprocessor.open-git-repo]
command = "mdbook-open-git-repo"
renderer = ["html"]
```
Add a repository URL to use as a base in your `book.toml`:
```toml
[output.html]
git-repository-url = "https://github.com/organization/repo"
```
Repos hosted on either github.com or gitlab.com will automatically be detected.
If you are using eg. a self-hosted GitLab instance, you must specify the type
of host:
```toml
[preprocessor.open-git-repo]
source-control-host = "gitlab"
```
The default content generated is the following:
```
Found a bug? Edit this file on GitHub.
```
Both the text before and inside the `` tag may be customised:
```toml
[preprocessor.open-git-repo]
edit-text = "Something not right?"
link-text = "Fix it immediately!"
```
Which would produce the following output:
```
Something not right? Fix it immediately!
```
To style the footer add a custom CSS file for your HTML output:
```toml
[output.html]
additional-css = ["open-in.css"]
```
And in `open-in.css` style the `