Open corinabioinformatic opened 1 year ago
But when render my book and I click on that "Edit icon" I get again the error page in Bitbucket.
What is the link supposed to be for bitbucket source file edition ?
What would be the correct link to generate ?
The link for bitbucket source file edition is something like this: "https://bitbucket.whatever.com/projects/my_repo_name/repos/my_bookdown/browse/my_Rmd.Rmd" and it appears the Rmd file window with thebutton option to "Edit" in bitbucket. and when you click on it, the address do not change, but the window enable to edit the content on the Rmd and below there is a new button that let you "commit" changes.
I searched online about this issue but I did not found a solution yet. Here my Stackoverflow question: https://stackoverflow.com/questions/76590504/how-could-i-add-a-link-for-the-edit-icon-to-private-bitbucket-repo
What you described above does not match what you put in your configuration
edit:
link: bitbucket.whatever.com/my_username/my_repo_name/edit/master/%s
I believe Bitbucket is adding some parameters to URL so you could try putting the same url you have in your browser and adds ?mode=edit&at=main
at the end.
The URL I got on bitbucket.org is not exactly the same as yours though
https://bitbucket.org/dervieuxchr/bookdown-demo/src/main/README.md
when I clicked it adds mode=edit&at=main
So you need to adapt and put the right url in edit
config, leaving %s
where the filename should go.
Hello,
Same problem here but with the links to a devops repo
I've modified the links in the "_output.yml" :
bookdown::bs4_book:
css: css/style.css
theme:
primary: "#096B72"
repo: https://dev.azure.com/company_name/project_name/_git/repo_name
edit: https://dev.azure.com/company_name/project_name/_git/repo_name&path=/%s
But the links on the built book are modified as:
And another question : how to open the link on a new tab ?
I think the problem comes from the function tweak_navbar()
in bs4_book.R :
repo_edit <- paste0(repo$base, "/edit/", repo$branch, "/", repo$subdir, rmd_index[[active]])
repo_view <- paste0(repo$base, "/blob/", repo$branch, "/", repo$subdir, rmd_index[[active]])
yes bs4_book() does not support the url you want to put. If should be extended in configuration to allow that.
This is probably part of
Any way to workaround other than make a local modified version of bookdown ?
Unfortunately know, you found the place where this is built https://github.com/rstudio/bookdown/blob/cedaac98f2d4b54a97865e5b050a38fb8938cc7f/R/bs4_book.R#L416-L427
Currently it will add the file in the path, and not as a query params like your dev azure expect.
A PR is welcome to improve support. Thanks !
I also modified the template_link()
function in order to open the link into a new tab, but I'm not sure that you want a new PR with that too ?
I also modified the
template_link()
function in order to open the link into a new tab, but I'm not sure that you want a new PR with that too ?
Yes you can make a PR for this too.
Hello, related to Bookdown I am editing the "index.Rmd" and "_output.yaml" file in order to make functional the "Edit" button. I followed the instructions detailed in this page: 29.4 Edits and source code
But when render my book and I click on that "Edit icon" I get again the error page in Bitbucket.
I have a private bitbucket and I added the following lines of code in the : "_output.yml"
"index.Rmd"
Does anybody know if Bookdown can have a Edit button to edit in a private Bitbucket repo? (or suggest edits?) Many thanks!