-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create mdbook-open-gh-issue from mdbook-open-on-gh
- Loading branch information
Showing
6 changed files
with
95 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
[package] | ||
name = "mdbook-open-on-gh" | ||
version = "2.4.2" | ||
authors = ["Jan-Erik Rediger <[email protected]>"] | ||
name = "mdbook-open-gh-issue" | ||
version = "0.1.0" | ||
authors = ["Vytautas Stankevičius <[email protected]>"] | ||
description = "mdbook preprocessor to add a open-on-github link on every page" | ||
license = "MPL-2.0" | ||
homepage = "https://github.com/badboy/mdbook-open-on-gh" | ||
repository = "https://github.com/badboy/mdbook-open-on-gh" | ||
homepage = "https://github.com/vytstank/mdbook-open-gh-issue" | ||
repository = "https://github.com/vytstank/mdbook-open-gh-issue" | ||
documentation = "https://github.com/slowsage/mdbook-pagetoc" | ||
readme = "README.md" | ||
keywords = ["mdbook"] | ||
exclude = [".github/"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
mdbook = "0.4.36" | ||
env_logger = "0.10.0" | ||
env_logger = "0.10" | ||
log = "0.4" | ||
clap = { version = "4.1.0", features = ["cargo"] } | ||
serde_json = "1.0" | ||
toml = "0.5.11" | ||
semver = "1.0.20" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
# mdbook-open-on-gh | ||
# mdbook-open-gh-issue | ||
|
||
A preprocessor for [mdbook][] to add a open-on-github link on every page. | ||
A preprocessor for [mdbook][] to add a "open github issue link" on every page. | ||
|
||
[mdbook]: https://github.com/rust-lang/mdBook | ||
|
||
It adds an "Edit this file on GitHub" link on the bottom of every page, linking directly to the source file. | ||
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-on-gh | ||
cargo install mdbook-open-gh-issue | ||
``` | ||
|
||
Add it as a preprocessor to your `book.toml`: | ||
|
||
``` | ||
[preprocessor.open-on-gh] | ||
command = "mdbook-open-on-gh" | ||
[preprocessor.open-gh-issue] | ||
command = "mdbook-open-gh-issue" | ||
renderer = ["html"] | ||
``` | ||
|
||
## Configuration | ||
|
||
`mdbook-open-on-gh` is configured using additional options under `[output.html]`: | ||
|
||
`mdbook-open-gh-issue` is configured using additional options under `[output.html]`: | ||
|
||
```toml | ||
[output.html] | ||
# Required: Your repository URL used in the link. | ||
git-repository-url = "https://github.com/$user/$project" | ||
|
||
# Your git branch. Defaults to `main` | ||
git-branch = "main" | ||
|
||
# The text to use in the footer. | ||
# The link text is marked by `[]` | ||
open-on-text = "Found a bug? [Edit this page on GitHub.]" | ||
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: | ||
|
||
```toml | ||
[output.html] | ||
additional-css = ["open-in.css"] | ||
additional-css = ["gh-issue-open.css"] | ||
``` | ||
|
||
And in `open-in.css` style the `<footer>` element or directly the CSS element id `open-on-gh`: | ||
And in `gh-issue-open.css` style the `<footer>` element or directly the CSS element id `gh-issue-open`: | ||
|
||
```css | ||
footer { | ||
|
@@ -62,14 +62,12 @@ footer { | |
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 | ||
``` | ||
|
||
## License | ||
## Acknowledgments | ||
|
||
MPL. See [LICENSE](LICENSE). | ||
Copyright (c) 2020-2022 Jan-Erik Rediger <[email protected]> | ||
- [mdbook-open-on-gh](https://github.com/badboy/mdbook-open-on-gh) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.