nbsync 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nbsync/cell.py CHANGED
@@ -30,22 +30,35 @@ class Cell:
30
30
  def convert(self) -> str:
31
31
  kind = self.image.attributes.pop("source", "")
32
32
  tabs = self.image.attributes.pop("tabs", "")
33
+ identifier = self.image.attributes.pop("identifier", "")
33
34
 
34
35
  if "/" not in self.mime or not self.content or kind == "source-only":
35
36
  if self.image.source:
36
- source = get_source(self, include_attrs=True)
37
+ source = get_source(
38
+ self,
39
+ include_attrs=True,
40
+ include_identifier=bool(identifier),
41
+ )
37
42
  kind = "only"
38
43
  else:
39
44
  source = ""
40
45
  result, self.image.url = "", ""
41
46
 
42
47
  elif self.mime.startswith("text/") and isinstance(self.content, str):
43
- source = get_source(self, include_attrs=True)
48
+ source = get_source(
49
+ self,
50
+ include_attrs=True,
51
+ include_identifier=bool(identifier),
52
+ )
44
53
  result, self.image.url = self.content, ""
45
54
  result = result.rstrip()
46
55
 
47
56
  else:
48
- source = get_source(self, include_attrs=False)
57
+ source = get_source(
58
+ self,
59
+ include_attrs=False,
60
+ include_identifier=bool(identifier),
61
+ )
49
62
  result = get_result(self)
50
63
 
51
64
  if markdown := get_markdown(kind, source, result, tabs):
@@ -54,12 +67,22 @@ class Cell:
54
67
  return "" # no cov
55
68
 
56
69
 
57
- def get_source(cell: Cell, *, include_attrs: bool = False) -> str:
70
+ def get_source(
71
+ cell: Cell,
72
+ *,
73
+ include_attrs: bool = False,
74
+ include_identifier: bool = False,
75
+ ) -> str:
58
76
  attrs = [cell.language]
59
77
  if include_attrs:
60
78
  attrs.extend(cell.image.iter_parts())
61
79
  attr = " ".join(attrs)
62
- return f"```{attr}\n{cell.image.source}\n```"
80
+
81
+ source = cell.image.source
82
+ if include_identifier:
83
+ source = f"# #{cell.image.identifier}\n{source}"
84
+
85
+ return f"```{attr}\n{source}\n```"
63
86
 
64
87
 
65
88
  def get_result(cell: Cell) -> str:
nbsync/py.typed ADDED
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbsync
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: MkDocs plugin treating Jupyter notebooks, Python scripts and Markdown files as first-class citizens for documentation with dynamic execution and real-time synchronization
5
5
  Project-URL: Documentation, https://daizutabi.github.io/nbsync/
6
6
  Project-URL: Source, https://github.com/daizutabi/nbsync
@@ -134,14 +134,6 @@ Use standard Markdown image syntax with the figure identifier:
134
134
  ![Chart description](my-notebook.ipynb){#my-figure}
135
135
  ```
136
136
 
137
- ## Advanced Usage
138
-
139
- For more detailed information on how to use nbsync, see:
140
-
141
- - [Notebook Configuration](usage/notebook.md) - Setting up notebook directories
142
- - [Class Options](usage/class.md) - Control how notebook content is displayed
143
- <!-- - [Workflow Tips](usage/workflow.md) - Best practices for documentation -->
144
-
145
137
  ## The Power of Separation
146
138
 
147
139
  Creating documentation and developing visualizations involve different
@@ -1,12 +1,13 @@
1
1
  nbsync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- nbsync/cell.py,sha256=HjGV7WHYwoW-X8AK9EePcjHz2wHl0rVaEAS_hdI8QNw,3248
2
+ nbsync/cell.py,sha256=HNgMDwA1KrMxyoxAL2wUrg3zdA1glveoXY5YbO_uFeM,3788
3
3
  nbsync/logger.py,sha256=tQK8Z8HdWQNhVohQYLwZtJhdaj2w0UTyhHQak3mPqNc,119
4
4
  nbsync/markdown.py,sha256=sGNPuyLTfQFv-I1m6jK6uDKFRHAPYY6hpy4P1bJjmkE,3185
5
5
  nbsync/notebook.py,sha256=Voh-e8RQsoYmWKnaHzAn4bm6Ud5v-aHwmng2Uc0rUts,1009
6
6
  nbsync/plugin.py,sha256=YywBAD7fcrPg3-_9T_kSuvD8RBzsc_ovlIviGlKR9po,2835
7
+ nbsync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
8
  nbsync/sync.py,sha256=RTF6h0izF1emc1CpG6atEgAQHC7mZCit9NkXK26sOA8,3575
8
- nbsync-0.1.0.dist-info/METADATA,sha256=t97_Xq3uoqCGveX9XblM-zTwyHA7npBBK32PdhN_e9Y,6604
9
- nbsync-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- nbsync-0.1.0.dist-info/entry_points.txt,sha256=bSqmJTDmrUoSm4yDjk8YDWxI71SShx16judadGdiKbA,47
11
- nbsync-0.1.0.dist-info/licenses/LICENSE,sha256=wy1pqn52upuo_qYwY-epWmspwE-3UWJso0xodciGXYc,1062
12
- nbsync-0.1.0.dist-info/RECORD,,
9
+ nbsync-0.1.2.dist-info/METADATA,sha256=pFmxrIBJQeRONm0hDZwMWg2mCL84XUdrEbDRG4Hu0v4,6287
10
+ nbsync-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
+ nbsync-0.1.2.dist-info/entry_points.txt,sha256=bSqmJTDmrUoSm4yDjk8YDWxI71SShx16judadGdiKbA,47
12
+ nbsync-0.1.2.dist-info/licenses/LICENSE,sha256=wy1pqn52upuo_qYwY-epWmspwE-3UWJso0xodciGXYc,1062
13
+ nbsync-0.1.2.dist-info/RECORD,,
File without changes