Sphinx) sphinx-rtd-theme에서 Edit on Github 또는 Gitlab 으로 변경하는 방법

2022. 2. 5. 17:27꿀팁 분석 환경 설정/파이썬 개발 팁

728x90

 

sphinx-rtd-theme 에서 github 링크로 가는 방법에 대해서 공유한다.

이것은 gitlab 역시 동일하다.

 

코드 추가

 

source 에서 index.rst 에 아래와 같이 github_url을 넣어준다.

 

.. test documentation master file, created by
   sphinx-quickstart on Wed Jan 26 10:55:52 2022.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

:github_url:
   https://github.com/sungreong/sphinx-test

Welcome to test's documentation!
================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   modules



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

build

cd docs
make clean (초기화 optional)
make build

 

 

 

 

docs 에 index.html을 만들고 아래와 같은 코드를 추가 해야한다.

<html>

<head>
    <meta http-equiv="refresh" content="0; url=./build/html/index.html" />
</head>

</html>

자세한 것은 아래 블로그 github을 참고하면 좋다.

https://blog.naver.com/pjt3591oo/222067596734

 

여기서 엄청난 삽질을 했다...

 

 

이걸 안해주면 Github Pages에서 반영이 안된다.

 

Git push를 해주고 기다리면...

 

Github

https://sungreong.github.io/sphinx-test/

 

Welcome to test’s documentation! — sphinx-test documentation

© Copyright 2022, srlee.

sungreong.github.io

 

https://github.com/sungreong/sphinx-test

 

GitHub - sungreong/sphinx-test: sphinx 테스트 해보기

sphinx 테스트 해보기. Contribute to sungreong/sphinx-test development by creating an account on GitHub.

github.com

 

728x90