Skip to content

Commit 9f0bf6d

Browse files
juiwenchenubmarco
authored andcommitted
created a demo
1 parent b84f703 commit 9f0bf6d

5 files changed

Lines changed: 87 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ codelinks = "sphinx_codelinks.cmd:app"
7676
"docs:rm" = "rm -rf docs/_build/html"
7777
"docs" = "sphinx-build -nW --keep-going -b html -T -c docs docs/source docs/_build/html"
7878
"docs:clean" = { chain = ["docs:rm", "docs"] }
79+
# needextend demo
80+
"analyse" = "codelinks analyse tests/data/analyse/default_config.toml"
81+
"analyse:rm" = "rm -rf output/marked_content.json"
82+
"bridge" = "codelinks bridge output/marked_content.json --outdir tests/data/needextend_demo"
83+
"bridge:rm" = "rm -rf tests/data/needextend_demo/needextend.rst"
84+
"demo:rm" = "rm -rf tests/data/needextend_demo/_build"
85+
"demo:build" = "sphinx-build -nW --keep-going -b html -T -c tests/data/needextend_demo tests/data/needextend_demo tests/data/needextend_demo/_build/html"
86+
"demo:clean" = { chain = [
87+
"demo:rm",
88+
"analyse:rm",
89+
"bridge:rm",
90+
"analyse",
91+
"bridge",
92+
"demo:build",
93+
] }
7994

8095
[tool.ruff.lint]
8196
extend-select = [
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Needextend Demo
2+
3+
Run the following command in project root to have demo generated
4+
5+
```bash
6+
rye run demo:clean
7+
```

tests/data/needextend_demo/conf.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "test_needextend"
10+
copyright = "2025, useblocks"
11+
author = "team useblocks"
12+
13+
# -- General configuration ---------------------------------------------------
14+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
15+
16+
templates_path = ["_templates"]
17+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
18+
19+
20+
# -- Options for HTML output -------------------------------------------------
21+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
22+
23+
html_theme = "furo"
24+
# html_static_path = ["_static"]
25+
26+
extensions = ["sphinx_needs", "sphinx_codelinks"]
27+
28+
# for needextend to work with remote url
29+
needs_extra_options = ["remote_url"]
30+
31+
needs_string_links = {
32+
"custom_name": {
33+
"regex": r"^(?P<value>.+)#L(?P<lineno>.*)?",
34+
"link_url": "{url}",
35+
"link_name": "{{value}}#L{{lineno}}",
36+
"options": ["remote_url"],
37+
}
38+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. impl:: title 1
2+
:id: NEED_001
3+
4+
.. impl:: title 2
5+
:id: NEED_002
6+
7+
.. impl:: title 3
8+
:id: NEED_003
9+
10+
.. impl:: title 4
11+
:id: NEED_004
12+
13+
.. include:: needextend.rst
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. needextend:: NEED_001
2+
:remote_url: https://github.com/useblocks/sphinx-codelinks/blob/1759d19e8694c049c68e7f95ce93d951d1ed0336/tests/data/need_id_refs/dummy_1.cpp#L3
3+
4+
.. needextend:: NEED_002
5+
:remote_url: https://github.com/useblocks/sphinx-codelinks/blob/1759d19e8694c049c68e7f95ce93d951d1ed0336/tests/data/need_id_refs/dummy_1.cpp#L3
6+
7+
.. needextend:: NEED_003
8+
:remote_url: https://github.com/useblocks/sphinx-codelinks/blob/1759d19e8694c049c68e7f95ce93d951d1ed0336/tests/data/need_id_refs/dummy_1.cpp#L3
9+
10+
.. needextend:: NEED_004
11+
:remote_url: https://github.com/useblocks/sphinx-codelinks/blob/1759d19e8694c049c68e7f95ce93d951d1ed0336/tests/data/need_id_refs/dummy_1.cpp#L3
12+
13+
.. needextend:: NEED_003
14+
:remote_url: https://github.com/useblocks/sphinx-codelinks/blob/1759d19e8694c049c68e7f95ce93d951d1ed0336/tests/data/need_id_refs/dummy_1.cpp#L8

0 commit comments

Comments
 (0)