File tree 1 file changed +81
-0
lines changed
1 file changed +81
-0
lines changed Original file line number Diff line number Diff line change 79
79
80
80
Again, the problem of distinguishing inputs / outputs persists.
81
81
82
+
83
+ 2023-01-27: New idea: backticks
84
+
85
+
86
+ Syntax Idea #1: Use markdown with explicit python tags
87
+
88
+ def foobar():
89
+ '''
90
+ Example:
91
+ ```python
92
+ x = 1
93
+ y = 2
94
+ print(x + y)
95
+ ```
96
+
97
+ ```output
98
+ 3
99
+ ```
100
+
101
+ '''
102
+
103
+
104
+ Syntax Idea #2: Use a simplified markdown tag that is reminicent of markdown
105
+
106
+ def foobar():
107
+ '''
108
+ Example:
109
+ `python
110
+ x = 1
111
+ y = 2
112
+ print(x + y)
113
+
114
+ `output
115
+ 3
116
+
117
+ '''
118
+
119
+
120
+ Syntax Idea #3: Lead output with an xdoctest directive
121
+
122
+ def foobar():
123
+ '''
124
+ Example:
125
+ # xdoctest: example
126
+ x = 1
127
+ y = 2
128
+ print(x + y)
129
+
130
+ # xdoctest: output
131
+ 3
132
+ '''
133
+
134
+
135
+ Shorter prefixes?
136
+
137
+ def foobar():
138
+ '''
139
+ Example:
140
+ > x = 1
141
+ > y = 2
142
+ > print(x + y)
143
+ 3
144
+ '''
145
+
146
+
147
+ First line matters?
148
+ def foobar():
149
+ '''
150
+ Example:
151
+
152
+ .. code:: python
153
+
154
+ x = 1
155
+ y = 2
156
+ print(x + y)
157
+
158
+ .. code:: output
159
+
160
+ 3
161
+ '''
162
+
82
163
"""
You can’t perform that action at this time.
0 commit comments