mdbook-open-gh-issue

Crates.iomdbook-open-gh-issue
lib.rsmdbook-open-gh-issue
version0.1.1
sourcesrc
created_at2023-12-18 11:56:23.820075
updated_at2023-12-18 12:27:39.383862
descriptionmdbook preprocessor to add a open-on-github link on every page
homepagehttps://github.com/vytstank/mdbook-open-gh-issue
repositoryhttps://github.com/vytstank/mdbook-open-gh-issue
max_upload_size
id1073310
size81,042
Vytautas Stankevičius (vytstank)

documentation

https://github.com/vytstank/mdbook-open-gh-issue

README

mdbook-open-gh-issue

A preprocessor for mdbook to add a "open github issue link" on every page.

It adds an "Open issue on GitHub for this file" link on the bottom of every page, linking directly to the source file. It uses the configured git-repository-url as the base.

Installation

If you want to use only this preprocessor, install the tool:

cargo install mdbook-open-gh-issue

Add it as a preprocessor to your book.toml:

[preprocessor.open-gh-issue]
command = "mdbook-open-gh-issue"
renderer = ["html"]

Configuration

mdbook-open-gh-issue is configured using additional options under [output.html]:

[output.html]
# Required: Your repository URL used in the link.
git-repository-url = "https://github.com/$user/$project"

# The text to use in the footer.
# The link text is marked by `[]`
gh-issue-text = "Outdated info? [Open issue on GitHub.]"

# The issue template to use. Defaults to "issue-template.yaml"
# New issue will get "file" parameter set to the current page.
gh-issue-template = "issue-template.yaml"

To style the footer add a custom CSS file for your HTML output:

[output.html]
additional-css = ["gh-issue-open.css"]

And in gh-issue-open.css style the <footer> element or directly the CSS element id gh-issue-open:

footer {
  font-size: 0.8em;
  text-align: center;
  border-top: 1px solid black;
  padding: 5px 0;
}

This code block shrinks the text size, center-aligns it under the rest of the content and adds a small horizontal bar above the text to separate it from the page content.

Finally, build your book as normal:

mdbook path/to/book

Acknowledgments

Commit count: 80

cargo fmt