Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/suggest an edit link #1506

Merged
merged 8 commits into from
Apr 26, 2021

Conversation

flavio
Copy link
Contributor

@flavio flavio commented Apr 19, 2021

This PR is based on #1148 and supersedes it.

Compared to the originating PR, this one rebases the code against the current master branch and, most important of all, fixes the broken links reported by the early testers of this feature. I'm referring to the broken links to pages that were named README.md.

I've successfully tested this feature against a complex mdbook hosted on GitHub, Bitbucket and Gitea

xkr47 and others added 7 commits April 19, 2021 14:51
Includes new configuration option `git-repository-edit-baseurl` for
supporting non-GitHub repository layouts.
The `IndexPreprocessor` rewrites the path for files
named `README.md` to be `index.md`. This breaks the edit link
in some circumstances.

To address this issues, the `Chapter` struct has now a new attribute
called `source_path`. This is initialized with the same value as
`path`, but is never ever changed.

Finally, the edit link is built by using the `source_path` rather
than the `path`.
Add a working example of the edit links feature to the examples
Add "edit" links to the pages of mdbook own book
@flavio
Copy link
Contributor Author

flavio commented Apr 19, 2021

ping @ehuss: this is the updated PR for the edit links feature

@ehuss
Copy link
Contributor

ehuss commented Apr 26, 2021

Thanks for picking this up!

I was thinking, since this isn't related to git in any way, perhaps the field could be called edit-url-template? I realize that is inconsistent with git-repository-url, which also doesn't have much to do with git other than showing GitHub's logo. But I think it is nice to just simplify it a little.

Otherwise looks good to me!

Change the name of the git-repository-edit-url-template to be more
generic: `edit-url-template`

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@flavio
Copy link
Contributor Author

flavio commented Apr 26, 2021

@ehuss: sure, that's fine with me. I updated the PR to reflect your suggestion. Let me know if you want me to squash the last commit with the previous one.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ehuss ehuss merged commit a72d600 into rust-lang:master Apr 26, 2021
@flavio flavio deleted the feature/suggest-an-edit-link branch April 26, 2021 19:41
ericonr added a commit to ericonr/void-docs that referenced this pull request May 25, 2021
Need to filter what we actually need from this file, but it includes
accessibility and navigation fixes, plus the additions necessary for
edit-url-template [1] to work.

[1] rust-lang/mdBook#1506
@ehuss ehuss mentioned this pull request Jul 9, 2021
shawn111 added a commit to shawn111/dotfiles that referenced this pull request Feb 18, 2024
improve github-page intergration
rust-lang/mdBook#1506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants