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

DOC: fix 'Who uses Sphinx-Gallery' list #1015

Merged
merged 1 commit into from Sep 28, 2022

Conversation

StefRe
Copy link
Contributor

@StefRe StefRe commented Sep 23, 2022

the current link in https://sphinx-gallery.github.io/stable/projects_list.html results in 404.

  • prevent the project lists in README.rst and projects_list.rst from
    becoming out of sync by putting the projects list in a text file
    to include in both rst files (there were already 2 projects more in
    README.rst than in projects_list.rst)
  • fix broken and some permanently redirected links reported by linkcheck

Github markup doesn't allow including files into README.rst, so we must
include from README.rst. Github doesn't process :ref: or :doc: roles
(they are shown literally) so we need to handle the Sphinx Gallery link
separately. The intersphinx links were replaced by ordinary links as
it's very unlikely that these targets would be changed without a
redirect in place.

@lucyleeow
Copy link
Contributor

Could you update it in our README.rst too?

@StefRe StefRe marked this pull request as draft September 24, 2022 09:35
@StefRe StefRe changed the title DOC: fix Nilearn docs link DOC: Sync Who uses Sphinx between README and projects_list Sep 24, 2022
@StefRe StefRe changed the title DOC: Sync Who uses Sphinx between README and projects_list DOC: fix 'Who uses Sphinx-Gallery' list Sep 24, 2022
@StefRe StefRe marked this pull request as ready for review September 24, 2022 09:52
@StefRe StefRe marked this pull request as draft September 24, 2022 15:58
@StefRe
Copy link
Contributor Author

StefRe commented Sep 24, 2022

sorry for the many pushes. build_docs error is unrelated to this PR, see #1017 . It took a while for me to understand the CI now uses sphinx 5.2.0, I used 5.1.1 locally.

@StefRe StefRe marked this pull request as ready for review September 24, 2022 18:32
Copy link
Contributor

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

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

Thank you! Just a nit

README.rst Outdated Show resolved Hide resolved
doc/projects_list.txt Outdated Show resolved Hide resolved
@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

hm, the github rst parser seems to not like the :start-after: and :end-before: options, it doesn't include anything see https://github.com/StefRe/sphinx-gallery/tree/fix/who-uses-links, or am I missing something here? Any ideas, @lucyleeow ?

@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

maybe this is caused by https://github.com/github/markup#github-markup?:

The HTML is sanitized, aggressively removing things that could harm you and your kin—such as script tags, inline-styles, and class or id attributes.

@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

Changing the order of inclusion doesn't work either as github doesn't process the roles:
grafik

@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

@lucyleeow so I guess I'll have to get back to the original version with the included txt file which isn't ideal but works correctly.

@lucyleeow
Copy link
Contributor

What about just including the whole doc/projects_list.rst file (including the title)? Does the title end up looking weird? Maybe we can amend the title underscore markup?

Thanks again for working on this!

@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

Up to about 20 mins ago I was convinced that including the complete txt file into README.rst did work correctly but when I now try to reproduce it I can't make it work (see https://github.com/StefRe/sphinx-gallery/tree/fix/test_who-uses-links).

It turns out that including files into rst is blocked for security reasons, see github/markup#172 (comment). Including files into markdown doesn't work either (github/markup#346) and there are obviously no plans to pursue any of this.

I'll try and think of another solution.

@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

PyPi packages also don't process sphinx extension:

- reStructuredText (without Sphinx extensions)

(the entry for SG uses :ref: to automatically switch between dev and stable, see #754)
(the entries for Scikit-learn and matplotlib use intersphinx links introduced in #819, the advantage is not clear to me (other than maybe if they would change their docs url without a redirect, which is rather unlikely))

@larsoner
Copy link
Contributor

Let's just get rid of :ref: and use HTML links for the README

Also in some packages for RST that will only be included (not rendered alone) I've seen name.inc (for "include") used. It prevents Sphinx from rendering it twice -- once as an "include" in the correct spot, and once as a standalone file where you don't want it.

- prevent the project lists in README.rst and projects_list.rst from
  becoming out of sync (there were already 2 projects more in
  README.rst than in projects_list.rst)
- fix broken and some permanently redirected links reported by linkcheck

Github markup doesn't allow including files into README.rst, so we must
include from README.rst. Github doesn't process :ref: or :doc: roles
(they are shown literally) so we need to handle the Sphinx Gallery link
separately. The intersphinx links were replaced by ordinary links as
it's very unlikely that these targets would be changed without a
redirect in place.
@StefRe
Copy link
Contributor Author

StefRe commented Sep 26, 2022

This is the best compromise I could achieve: it preserves the :ref: for SG from #754 but reverts the intersphinx links from #819.
The only little blemish is the additional empty line between Sphinx Gallery and the other projects:

in README.rst:
grafik

in the docs:
grafik

@StefRe StefRe marked this pull request as ready for review September 26, 2022 15:28
README.rst Show resolved Hide resolved
@lucyleeow lucyleeow merged commit f742796 into sphinx-gallery:master Sep 28, 2022
@lucyleeow
Copy link
Contributor

Thanks @StefRe !

@StefRe StefRe deleted the fix/who-uses-links branch September 28, 2022 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants