Upgrade to Pro — share decks privately, control downloads, hide ads and more …

sphinx-new-tab-link (2023/11 #guidomeetup)

November 29, 2023

sphinx-new-tab-link (2023/11 #guidomeetup)





November 29, 2023

More Decks by nikkie

Other Decks in Technology


  1. Hello! • Please call me nikkie • Python is a

    tool that feels very natural to me / Pythonはとても手に馴染むツー ルです ◦ Thank you, Guido-san, for creating Python. • I enjoy reading Python documentation, as well as the documentation for libraries implemented in Python / PythonやPythonで実装されたライブラリの ドキュメントを読むのが好きです
  2. When reading documentation in a browser e.g. Sorting HOW TO

    • Click a link to Wikipedia (external site) • Wikipedia opens in the same tab • To compare it side-by- side, always ⌘ + Click 😣
  3. The Sphinx documentation generator • Many documents are made with

    Sphinx • I developed a Sphinx extension that opens external site links in a new browser tab / 外部サイトのリンクをブラウザの別のタブで開くSphinx拡張 を自作しました • called sphinx-new-tab-link ◦ I wanted it so badly / 喉から手が出るほどほしかった!
  4. • Click a link to PyPI (external site) • Open

    PyPI in a new tab without ⌘+Click🎉 e.g. https://ftnext.github.io/sphin x-new-tab- link/guide.en.html With sphinx-new-tab-link
  5. A lot of thank-you / 先人にありがとう • implementation from StackOverflow

    / 実装方法はStackOverflowから ◦ since I couldn't find it on PyPI, I published sphinx-new-tab-link • learned how to develop Sphinx extensions at PyCon / PyConでSphinx拡張の 開発方法を知る ◦ About tests Sphinxを通して考える、「拡張」の仕方 (PyCon JP 2022) • an issue and a pull request, sphinx-new-tab-link now supports dirhtml 🙌 ◦ Does not seem to work anymore with dirhtml builder #6
  6. Try sphinx-new-tab-link! Thank you With • reStructuredText • Python files

    (sphinx.ext.autodoc) • Markdown (MyST-Parser) 2 steps pip install sphinx-new-tab-link # conf.py extensions = ["sphinx_new_tab_link"] Even if it's not from Guido-san, I'm always happy to receive feedback /(Guidoさん以外からも)フィードバ ック歓迎です
  7. Self-introduction / お前、誰よ • nikkie にっきー, Twitter @ftnext, Blog (はてなブログ)

    • Use Python since 2017, private & work • Data scientist at 株式会社ユーザベース • PyCon JP 2021 Chair🪑 (座長) • https://github.com/ftnext ◦ develop: sphinx-new-tab-link, hayasaka, e.t.c. ◦ maintain: Uberi/speech_recognition
  8. .. reStructuredText External link: `Example <https://example.com/>`_ <!-- Without sphinx-new-tab-link -->

    <a class="reference external" href="https://example.com/">Example</a> <!-- WITH sphinx-new-tab-link --> <a class="reference external" href="https://example.com/" rel="noopener noreferrer" target="_blank">Example</a> How sphinx-new-tab-link works
  9. Links • https://pypi.org/project/sphinx-new-tab-link/ • Recent state: sphinx-new-tab-link リリース1周年! Sphinx拡張公開で広がっ ていく世界に、ありがとう

    • With Python files & autodoc: sphinx.ext.autodocでdocstringを元に作った HTMLの中の外部リンクも、sphinx-new-tab-link を使ってブラウザの新しい タブで開けることを確認しました • With Markdown: Markdownの原稿をSphinxで変換して作ったHTMLの中の外 部リンクも、sphinx-new-tab-link を使ってブラウザの新しいタブで開けるこ とを確認しました