pradyunsg / furo

A clean customizable documentation theme for Sphinx
https://pradyunsg.me/furo/quickstart
MIT License
2.76k stars 317 forks source link

Add `source_edit_link` as supported theme configuration parameter #510

Closed ryuwd closed 2 years ago

ryuwd commented 2 years ago

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!

cassava commented 2 years ago

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

marxin commented 2 years ago

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.

ryuwd commented 2 years ago

Oops. Let me fix this conflict and rebase

edit: OK, ready to go now

marxin commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

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

marxin commented 2 years ago

Great, thanks for it!