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

Add source_edit_link as supported theme configuration parameter #510

Merged
merged 1 commit into from Sep 29, 2022

Conversation

ryuwd
Copy link
Contributor

@ryuwd ryuwd commented Aug 31, 2022

This was necessary to avoid the below message, and generate the edit button correctly pointing to a custom gitlab instance

preparing documents... WARNING: unsupported theme option 'source_edit_link' given

This fix (and especially this theme) works nicely for our doc site!

@ryuwd ryuwd changed the title Add source_edit_link as theme configuration parameter Add source_edit_link as supported theme configuration parameter Aug 31, 2022
@cassava
Copy link

cassava commented Sep 29, 2022

This would also be useful for me. This re-uses the capability already present in sphinx-basic-ng.

@marxin
Copy link
Contributor

marxin commented Sep 29, 2022

Oh, it's pretty similar to my #528 where I added also one hunk in ``src/furo/theme/furo/components/edit-this-page.html` which is needed for proper displaying of Edit icon.

docs/conf.py Outdated Show resolved Hide resolved
@ryuwd
Copy link
Contributor Author

ryuwd commented Sep 29, 2022

Oops. Let me fix this conflict and rebase

edit: OK, ready to go now

add entry additionally in conf.py

Remove unnecessary line from conf.py
@marxin
Copy link
Contributor

marxin commented Sep 29, 2022

Well it works for me with the following configuration:

html_theme_options = {
    'source_edit_link': '_sources/{filename}.txt',
    'source_repository': 'xxx',
    'source_branch': 'yyy'
}

I can't use only source_edit_link': '_sources/{filename}.txt', because of the following condition:
https://github.com/pradyunsg/sphinx-basic-ng/blob/a09afb4d587bf09c3f7ecdef31829f95808b84d3/src/sphinx_basic_ng/theme/basic-ng/components/edit-this-page.html#L50

Or do I miss something?

@pradyunsg
Copy link
Owner

pradyunsg commented Sep 29, 2022

It’s an or statement. You should be able to use it (assuming you get main from both projects) by only declaring the edit link.

@marxin
Copy link
Contributor

marxin commented Sep 29, 2022

No, it's not working when I install main branches for all projects. The following is missing:
https://github.com/marxin/furo/blob/1d72ecbad5afafe9fa9c5b0b6f0ba1a646148d57/src/furo/theme/furo/components/edit-this-page.html#L27-L28

@pradyunsg
Copy link
Owner

Well, I went ahead and cleaned things up. :)

https://pradyunsg.me/furo/customisation/edit-button/ will update to reflect the new semantics.

@marxin
Copy link
Contributor

marxin commented Sep 30, 2022

Great, thanks for it!

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

4 participants