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

📚 clarify needimport argument format #1384

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions docs/directives/needimport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,31 @@ You can generate a valid file using the builder :ref:`needs_builder`, for exampl
:pre_template: pre_template.rst
:post_template: post_template.rst

The directive needs an absolute or relative path as argument.
If the path is relative, we derive an absolute path based on the location of the document being compiled.
The directive argument can be one of the following formats:

The directive also supports URL as argument to download ``needs.json`` from remote, for example:
- A remote URL from which to download the ``needs.json``:

.. code-block:: rst
.. code-block:: rst

.. needimport:: https://my_company.com/docs/remote-needs.json

- A local path relative to the containing document:

.. code-block:: rst

.. needimport:: needs.json

- A local path starting with ``/`` is relative to the Sphinx source directory:

.. code-block:: rst

.. needimport:: /path/to/needs.json

- For an absolute path, make sure to start with two ``//`` (on Linux/OSX):

.. needimport:: https://my_company.com/docs/remote-needs.json
.. code-block:: rst

.. needimport:: //absoulte/path/to/needs.json

Options
-------
Expand Down
Loading