-
Notifications
You must be signed in to change notification settings - Fork 1
🔧Fix default config #4
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d877a45
fixed oneline warnings
juiwenchen e473b1d
udpated default config adaption
juiwenchen b5e1035
fixed links in multi-projects
juiwenchen fbf0bc3
fixed mypy
juiwenchen 8197e47
improved docs
juiwenchen 38c7aad
escaped
juiwenchen bd2ebd1
adapted
juiwenchen bdffd3f
updated docs
juiwenchen 0c17a49
added gif
juiwenchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,54 @@ | ||
Quick Start | ||
=========== | ||
|
||
``CodeLinks`` provides ``src-trace`` directive and it can be used in the following ways: | ||
.. image:: local_link.gif | ||
|
||
.. code-block:: rst | ||
Three steps to quickly run ``CodeLinks`` to achieve **the above**: | ||
|
||
.. src-trace:: example_with_file | ||
:project: project_config | ||
:file: example.cpp | ||
- Configure Sphinx | ||
- Apply One-line comment for a ``Sphinx-Needs`` need item | ||
- Use ``src-trace`` directive | ||
|
||
or | ||
|
||
.. code-block:: rst | ||
|
||
.. src-trace:: example_with_directory | ||
:project: project_config | ||
:directory: ./example | ||
|
||
``src-trace`` directive has the following options: | ||
|
||
* **project**: the project config specified in ``conf.py`` or ``toml`` file to be used for source tracing. | ||
* **file**: the source file to be traced. | ||
* **directory**: the source files in the directory to be traced recursively. | ||
|
||
Regarding the **file** and **directory** options: | ||
|
||
- they are optional and mutually exclusive. | ||
- the given paths are relative to ``src_dir`` defined in the source tracing configuration | ||
- if not given, the whole project will be examined. | ||
|
||
Example | ||
------- | ||
|
||
With the following configuration for a demo source code project `dcdc <https://github.com/useblocks/sphinx-codelinks/tree/main/tests/data/dcdc>`_, | ||
Sphinx Config | ||
------------- | ||
|
||
.. code-block:: python | ||
:caption: conf.py | ||
|
||
extensions = [ | ||
'sphinx_needs', | ||
'sphinx_codelinks' | ||
] | ||
src_trace_config_from_toml = "src_trace.toml" | ||
|
||
.. literalinclude:: ./../../src_trace.toml | ||
:caption: src_trace.toml | ||
:language: toml | ||
:lines: 27-29 | ||
|
||
``src-trace`` directive can be used with **file** option: | ||
One-line comment | ||
---------------- | ||
|
||
.. code-block:: rst | ||
.. literalinclude:: ./../../../tests/doc_test/minimum_config/dummy_src.cpp | ||
:caption: dummy_src.cpp | ||
:language: cpp | ||
|
||
.. src-trace:: dcdc demo_1 | ||
:project: dcdc | ||
:file: ./charge/demo_1.cpp | ||
|
||
The needs defined in source code are extracted and rendered to: | ||
Directive | ||
--------- | ||
|
||
.. src-trace:: dcdc demo_1 | ||
:project: dcdc | ||
:file: ./charge/demo_1.cpp | ||
.. literalinclude:: ./../../../tests/doc_test/minimum_config/index.rst | ||
:caption: index.rst | ||
:language: rst | ||
|
||
``src-trace`` directive can be used with **directory** option: | ||
|
||
.. code-block:: rst | ||
|
||
.. src-trace:: dcdc charge | ||
:project: dcdc | ||
:directory: ./discharge | ||
Example | ||
------- | ||
|
||
The needs defined in source code are extracted and rendered to: | ||
.. src-trace:: dummy src | ||
:project: src | ||
|
||
.. src-trace:: dcdc charge | ||
:project: dcdc | ||
:directory: ./discharge | ||
.. note:: **local-url** is not working on the website as it only supports local browse | ||
|
||
To have a more customized configuration of ``CodeLinks``, please refer to :ref:`configuration <configuration>`. | ||
Section :ref:`Directive <directive>` provides more adavanced usage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
.. _directive: | ||
|
||
Directive | ||
========= | ||
|
||
``CodeLinks`` provides ``src-trace`` directive and it can be used in the following ways: | ||
|
||
.. code-block:: rst | ||
|
||
.. src-trace:: example_with_file | ||
:project: project_config | ||
:file: example.cpp | ||
|
||
or | ||
|
||
.. code-block:: rst | ||
|
||
.. src-trace:: example_with_directory | ||
:project: project_config | ||
:directory: ./example | ||
|
||
``src-trace`` directive has the following options: | ||
|
||
* **project**: the project config specified in ``conf.py`` or ``toml`` file to be used for source tracing. | ||
* **file**: the source file to be traced. | ||
* **directory**: the source files in the directory to be traced recursively. | ||
|
||
Regarding the **file** and **directory** options: | ||
|
||
- they are optional and mutually exclusive. | ||
- the given paths are relative to ``src_dir`` defined in the source tracing configuration | ||
- if not given, the whole project will be examined. | ||
|
||
Example | ||
------- | ||
|
||
With the following configuration for a demo source code project `dcdc <https://github.com/useblocks/sphinx-codelinks/tree/main/tests/data/dcdc>`_, | ||
|
||
.. code-block:: python | ||
:caption: conf.py | ||
|
||
src_trace_config_from_toml = "src_trace.toml" | ||
|
||
.. literalinclude:: ./../../src_trace.toml | ||
:caption: src_trace.toml | ||
:language: toml | ||
:lines: 1-25 | ||
|
||
``src-trace`` directive can be used with **file** option: | ||
|
||
.. code-block:: rst | ||
|
||
.. src-trace:: dcdc demo_1 | ||
:project: dcdc | ||
:file: ./charge/demo_1.cpp | ||
|
||
The needs defined in source code are extracted and rendered to: | ||
|
||
.. src-trace:: dcdc demo_1 | ||
:project: dcdc | ||
:file: ./charge/demo_1.cpp | ||
|
||
``src-trace`` directive can be used with **directory** option: | ||
|
||
.. code-block:: rst | ||
|
||
.. src-trace:: dcdc charge | ||
:project: dcdc | ||
:directory: ./discharge | ||
|
||
The needs defined in source code are extracted and rendered to: | ||
|
||
.. src-trace:: dcdc charge | ||
:project: dcdc | ||
:directory: ./discharge | ||
|
||
.. note:: **local-url** is not working on the website as it only supports local browse | ||
|
||
To have a more customized configuration of ``CodeLinks``, please refer to :ref:`configuration <configuration>`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like .mp4 better because people can start/stop and seek in the video.
Example:
https://github.com/useblocks/ubcode/tree/main/docs/source/features/json_view
https://ubcode.useblocks.com/features/json_view/index.html
But we can merge it as it is (better than without).
Peek (https://github.com/phw/peek) supports it.