rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
17.7k stars 1.61k forks source link

Top menu bar did not show `edit` icon #1914

Closed astraw99 closed 1 year ago

astraw99 commented 1 year ago

Tried to set book.toml like this:

[output.html]
...
git-repository-url = "https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs"
edit-url-template = "https://github.com/kubernetes-sigs/kubebuilder/edit/master/docs/book/{path}"

Then mdbook serve locally, but only showed the git-repo icon, no edit icon.

ehuss commented 1 year ago

It looks like your book has overridden the theme/index.hbs file. That is where the icons are defined. You'll need to update that file with the latest changes. The latest version can be found here: https://github.com/rust-lang/mdBook/blob/master/src/theme/index.hbs

astraw99 commented 1 year ago

Added the git-edit code block, then edit icon shows.

{{#if git_repository_edit_url}}
    <a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit">
        <i id="git-edit-button" class="fa fa-edit"></i>
    </a>
{{/if}}

But when click the edit icon, it just redirect to page https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src, not the corresponding page that can edit directly. Any config I miss?

ehuss commented 1 year ago

I don't offhand know. Can you post your edits to a branch I can check out? Can you also include which version of mdbook you are using?

astraw99 commented 1 year ago

I don't offhand know. Can you post your edits to a branch I can check out? Can you also include which version of mdbook you are using?

You can check at this branch: https://github.com/astraw99/kubebuilder/blob/ftr-add-faq/docs/book/book.toml

mdbook --version
mdbook v0.4.21
ehuss commented 1 year ago

It looks like your plugins are out-of-date. Specifically here needs to be kept in sync with the definition with Chapter. I didn't test it (I couldn't get your plugins to work), but I would assume the missing source_path would be a good start.

astraw99 commented 1 year ago

OK, I will check it. Thanks. BTW, please help to check in by branch, why the print feature did not work?

ehuss commented 1 year ago

Sorry, I don't have the time to debug an external plugin. I'm going to close as this seems to be an issue with external tooling.