diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..459c386a7 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally build your docs in additional formats such as PDF +formats: + - epub + - pdf + - htmlzip + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3 + install: + - requirements: docs/requirements.txt + - requirements: requirements.txt diff --git a/docs/conf.py b/docs/conf.py index fa616ebbb..3ce98be4d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,30 +14,33 @@ import sys import os -# Allows to import youtube_dlc -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +# Allows to import yt-dlp +sys.path.insert(0, os.path.abspath('..')) +from recommonmark.transform import AutoStructify # -- General configuration ------------------------------------------------ +# The suffix of source filenames. +source_suffix = ['.rst', '.md'] + # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', + 'recommonmark', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] -# The suffix of source filenames. -source_suffix = '.rst' - # The master toctree document. master_doc = 'index' # General information about the project. -project = u'youtube-dlc' -copyright = u'2014, Ricardo Garcia Gonzalez' +project = u'yt-dlp' +copyright = u'UNLICENSE' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -62,10 +65,20 @@ pygments_style = 'sphinx' # a list of builtin themes. html_theme = 'default' +# Disable highlights +highlight_language = 'none' + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# html_static_path = ['_static'] + -# Output file base name for HTML help builder. -htmlhelp_basename = 'youtube-dlcdoc' +def setup(app): + app.add_config_value('recommonmark_config', { + 'enable_math': False, + 'enable_inline_math': False, + 'enable_eval_rst': True, + 'enable_auto_toc_tree': True, + }, True) + app.add_transform(AutoStructify) diff --git a/docs/faq.md b/docs/faq.md deleted file mode 100644 index b0f8cad14..000000000 --- a/docs/faq.md +++ /dev/null @@ -1,31 +0,0 @@ -- Q: How to redirect to another extractor? - - A: - - Most simple using only `url_result` - ``` - # get proper url first if needed. - return self.url_result(url) - ``` - - Using `_request_webpage` and `to_screen` in addition - ``` - urlh = self._request_webpage( - url, id, note='Downloading redirect page') - url = urlh.geturl() - self.to_screen('Following redirect: %s' % url) - return self.url_result(url) - ``` - - Using `return` construction - ``` - return { - '_type': 'url_transparent', - 'url': url, - 'ie_key': ExampleIE.ie_key(), - 'id': id, - } - # Alternative if extractor supports internal uri like kaltura - return { - '_type': 'url_transparent', - 'url': 'kaltura:%s:%s' % (partner_id, kaltura_id), - 'ie_key': KalturaIE.ie_key(), - 'id': id, - } - ``` diff --git a/docs/index.md b/docs/index.md new file mode 120000 index 000000000..32d46ee88 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index afa26fef1..000000000 --- a/docs/index.rst +++ /dev/null @@ -1,23 +0,0 @@ -Welcome to youtube-dlc's documentation! -====================================== - -*youtube-dlc* is a command-line program to download videos from YouTube.com and more sites. -It can also be used in Python code. - -Developer guide ---------------- - -This section contains information for using *youtube-dlc* from Python programs. - -.. toctree:: - :maxdepth: 2 - - module_guide - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..e97524889 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +recommonmark>=0.6.0 +m2r2 \ No newline at end of file