Skip to content

Commit 2814745

Browse files
committed
updated docs
1 parent 99b1f81 commit 2814745

4 files changed

Lines changed: 62 additions & 3 deletions

File tree

docs/source/components/write.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.. _write:
2+
3+
Write
4+
=====
5+
6+
The ``write`` command is used to generate reStructuredText files from the markers extracted by the ``analyse`` command.
7+
This allows you to create documentation that includes links to source code based on the need ids specified in your code comments.
8+
9+
Example usage
10+
-------------
11+
12+
With the following extracted markers fron the ``analyse`` command,
13+
14+
.. code-block:: json
15+
16+
{
17+
"my_project": [
18+
{
19+
"filepath": "/home/demo/git_repo/ub/sphinx-codelinks/tests/data/need_id_refs/dummy_1.cpp",
20+
"remote_url": "https://github.com/useblocks/sphinx-codelinks/blob/main/tests/data/need_id_refs/dummy_1.cpp#L3",
21+
"source_map": {
22+
"start": {"row": 2, "column": 13},
23+
"end": {"row": 2, "column": 51}
24+
},
25+
"tagged_scope": "void dummy_func1(){\n //...\n }",
26+
"need_ids": ["NEED_001", "NEED_002", "NEED_003", "NEED_004"],
27+
"marker": "@need-ids:",
28+
"type": "need-id-refs"
29+
},
30+
],
31+
}
32+
33+
The following RST file with :external+needs:ref:`needextend <needextend>` directive can be generated by the ``write rst`` command:
34+
35+
.. code-block:: rst
36+
37+
.. needextend:: NEED_001
38+
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/main/tests/data/need_id_refs/dummy_1.cpp#L3
39+
40+
.. needextend:: NEED_002
41+
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/main/tests/data/need_id_refs/dummy_1.cpp#L3
42+
43+
.. needextend:: NEED_003
44+
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/main/tests/data/need_id_refs/dummy_1.cpp#L3
45+
46+
.. needextend:: NEED_004
47+
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/main/tests/data/need_id_refs/dummy_1.cpp#L3
48+
49+
More examples can be found in `test cases <https://github.com/useblocks/sphinx-codelinks/blob/main/tests/test_needextend_write.py>`__

docs/source/development/change_log.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Changelog
88
1.0.0
99
-----
1010

11-
:Released: 12.08.2025
11+
:Released: 22.08.2025
1212

1313
New and Improved
1414
................
@@ -24,6 +24,11 @@ New and Improved
2424

2525
The extracted markers and their metadata are saved to a JSON file for further processing.
2626

27+
- ✨ Added a new ``write rst`` CLI command.
28+
29+
The ``write rst`` command write a reStructuredText file with :external+needs:ref:`needextend <needextend>` directive from the extracted markers generated by ``analyse``.
30+
The generated RST can be included in the Sphinx documentation to create the source code links in the existing needs
31+
2732
- 🔨 Replaced ``virtual_docs`` with the new ``analyse`` module.
2833

2934
The ``virtual_docs`` feature, which handled one-line need definitions (:ref:`OneLineCommentStyle <oneline>`),
@@ -33,7 +38,12 @@ New and Improved
3338
- 🔨 Updated the ``src-trace`` Sphinx directive.
3439

3540
The ``src-trace`` directive now uses the new ``analyse`` API instead of the old ``virtual_docs`` one.
36-
Note that the configuration files for ``src-trace`` and the ``analyse`` CLI are not yet compatible; this will be addressed in a future release.
41+
42+
- 🔨 Unified configuration in TOML
43+
44+
The configuration for ``src-trace`` directive defined in TOML is now compatible with the new ``analyse`` module.
45+
46+
3747

3848
.. _`release:0.1.2`:
3949

docs/source/development/roadmap.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Source Code Parsing
2525

2626
- Rust
2727
- YAML
28-
- SyML
2928

3029
- Enhance ``.gitignore`` handling to support nested ``.gitignore`` files.
3130

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Contents
6565
components/oneline
6666
components/analyse
6767
components/discover
68+
components/write
6869

6970
.. toctree::
7071
:maxdepth: 1

0 commit comments

Comments
 (0)