streamdown 0.35.0__tar.gz → 0.35.2__tar.gz
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.
- {streamdown-0.35.0 → streamdown-0.35.2}/PKG-INFO +5 -1
- {streamdown-0.35.0 → streamdown-0.35.2}/README.md +4 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/pyproject.toml +1 -1
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/sd.py +23 -5
- streamdown-0.35.2/tests/color-restore-after-link.md +1 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/.aider.chat.history.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/.aider.input.history +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/.aider.tags.cache.v4/cache.db +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/.envrc +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/.gitignore +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/.vimrc +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/24-bit-color.sh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/LICENSE.MIT +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/assets/logo.png +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/assets/logo.svg +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/configurable.png +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/copyable.png +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/dunder.png +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/error.txt +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/math +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/newdir/file_0.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/newdir/file_1.rb +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/newdir/file_2.jl +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/passthrough.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/pygments.util +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/python-go.png +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/re +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/requirements.txt +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/shutil +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/somelog.txt +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/ss-new.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/ss.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/__init__.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/plugins/README.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/plugins/latex.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/qwen3.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/ss +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/ss1 +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/streamdown/test.txt +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/subprocess +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/table.png +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/temp.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/test.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tester.py +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/README.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/backtick-with-post-spaces.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/bg-messed-up.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/blankie.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/block.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/bold_reset_with_link.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/broken-code.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/broken-example.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/chinese.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/chunk-buffer.sh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/cjj.mv +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/cjk-comment.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/cjk-table.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/cjk-wrap.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/code.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/dimcheck.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/example.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/fizzbuzz.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/fucking-garbage.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/inline.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/jimmy_webb.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/line-buffer.sh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/line-wrap.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/links.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/managerie.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/mandlebrot.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/markdown.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/nested-example.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/no-newline.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/oneline-equal.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/outline.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/output.txt +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/pvgo_512.jpg +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/pythonvgo.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/qwen3.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/rerun.zsh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/run-tests.sh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/slash.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/strip-chunks.sh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/table-break.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/table_test.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/test.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/test_input.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/uline.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tests/wm.md +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tools/deploy.sh +0 -0
- {streamdown-0.35.0 → streamdown-0.35.2}/tty +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamdown
|
|
3
|
-
Version: 0.35.
|
|
3
|
+
Version: 0.35.2
|
|
4
4
|
Summary: A streaming markdown renderer for modern terminals with syntax highlighting
|
|
5
5
|
Project-URL: Homepage, https://github.com/day50-dev/Streamdown
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/day50-dev/Streamdown/issues
|
|
@@ -156,6 +156,8 @@ $ sd --exec "llm chat"
|
|
|
156
156
|
|
|
157
157
|
And now you have all your readline stuff. It's pretty great. (Also see the DAY50 shellwrap project.)
|
|
158
158
|
|
|
159
|
+
This relies on "guessing" what a prompt will look like. But don't worry, you can change that with the `--prompt` option if yours is a bit unique. It's a PCRE regex, so you can be a bit flexible.
|
|
160
|
+
|
|
159
161
|
It's also worth noting that things like the `-c` aren't "broken" with regard to file input. You can do something like this:
|
|
160
162
|
|
|
161
163
|
```shell
|
|
@@ -188,6 +190,8 @@ optional arguments:
|
|
|
188
190
|
-w WIDTH, --width WIDTH
|
|
189
191
|
Set the width WIDTH
|
|
190
192
|
-e EXEC, --exec EXEC Wrap a program EXEC for more 'proper' i/o handling
|
|
193
|
+
-p PROMPT, --prompt PROMPT
|
|
194
|
+
A PCRE regex prompt to detect (default: ^.*>\s+$)
|
|
191
195
|
-s SCRAPE, --scrape SCRAPE
|
|
192
196
|
Scrape code snippets to a directory SCRAPE
|
|
193
197
|
-v, --version Show version information
|
|
@@ -126,6 +126,8 @@ $ sd --exec "llm chat"
|
|
|
126
126
|
|
|
127
127
|
And now you have all your readline stuff. It's pretty great. (Also see the DAY50 shellwrap project.)
|
|
128
128
|
|
|
129
|
+
This relies on "guessing" what a prompt will look like. But don't worry, you can change that with the `--prompt` option if yours is a bit unique. It's a PCRE regex, so you can be a bit flexible.
|
|
130
|
+
|
|
129
131
|
It's also worth noting that things like the `-c` aren't "broken" with regard to file input. You can do something like this:
|
|
130
132
|
|
|
131
133
|
```shell
|
|
@@ -158,6 +160,8 @@ optional arguments:
|
|
|
158
160
|
-w WIDTH, --width WIDTH
|
|
159
161
|
Set the width WIDTH
|
|
160
162
|
-e EXEC, --exec EXEC Wrap a program EXEC for more 'proper' i/o handling
|
|
163
|
+
-p PROMPT, --prompt PROMPT
|
|
164
|
+
A PCRE regex prompt to detect (default: ^.*>\s+$)
|
|
161
165
|
-s SCRAPE, --scrape SCRAPE
|
|
162
166
|
Scrape code snippets to a directory SCRAPE
|
|
163
167
|
-v, --version Show version information
|
|
@@ -117,6 +117,7 @@ visible = lambda x: re.sub(ANSIESCAPE, "", x)
|
|
|
117
117
|
# many characters have different widths
|
|
118
118
|
visible_length = lambda x: sum(wcwidth(c) for c in visible(x))
|
|
119
119
|
extract_ansi_codes = lambda text: re.findall(ESCAPE, text)
|
|
120
|
+
strip_ansi = lambda line: re.sub(ANSIESCAPE, '', line)
|
|
120
121
|
remove_ansi = lambda line, codeList: reduce(lambda line, code: line.replace(code, ''), codeList, line)
|
|
121
122
|
split_up = lambda line: re.findall(r'(\x1b[^m]*m|[^\x1b]*)', line)
|
|
122
123
|
|
|
@@ -129,7 +130,10 @@ def gettmpdir():
|
|
|
129
130
|
else:
|
|
130
131
|
tmp_dir = tmp_dir_all
|
|
131
132
|
|
|
133
|
+
prev_mask = os.umask(0)
|
|
134
|
+
# This is shared among all users
|
|
132
135
|
os.makedirs(tmp_dir, exist_ok=True)
|
|
136
|
+
os.umask(prev_mask)
|
|
133
137
|
return tmp_dir
|
|
134
138
|
|
|
135
139
|
def debug_write(text):
|
|
@@ -138,6 +142,10 @@ def debug_write(text):
|
|
|
138
142
|
state.Logging = tempfile.NamedTemporaryFile(dir=gettmpdir(), prefix="dbg", delete=False, mode="wb")
|
|
139
143
|
state.Logging.write(text)
|
|
140
144
|
|
|
145
|
+
def sub_extract(line, upto):
|
|
146
|
+
# this takes the line up to the upto string and then returns the ansi codes
|
|
147
|
+
return ''.join(extract_ansi_codes(line[:line.find(upto)]))
|
|
148
|
+
|
|
141
149
|
def savebrace():
|
|
142
150
|
if state.Savebrace and state.code_buffer_raw and os.name != 'nt':
|
|
143
151
|
path = os.path.join(gettmpdir(), 'savebrace')
|
|
@@ -446,7 +454,7 @@ def text_wrap(text, width = -1, indent = 0, first_line_prefix="", subsequent_lin
|
|
|
446
454
|
# that we have closed our hyperlink OSC
|
|
447
455
|
if LINK[0] in line_content:
|
|
448
456
|
line_content += LINK[1]
|
|
449
|
-
lines.append(line_content + resetter + state.bg + ' ' * margin)
|
|
457
|
+
lines.append(line_content + resetter + sub_extract(line_content, LINK[0]) + state.bg + ' ' * margin)
|
|
450
458
|
|
|
451
459
|
current_line = (" " * indent) + "".join(current_style) + word
|
|
452
460
|
|
|
@@ -496,6 +504,9 @@ def line_format(line):
|
|
|
496
504
|
|
|
497
505
|
# Apply OSC 8 hyperlink formatting after other formatting
|
|
498
506
|
def process_links(match):
|
|
507
|
+
#import pdb
|
|
508
|
+
#pdb.set_trace()
|
|
509
|
+
print(match)
|
|
499
510
|
description = match.group(1)
|
|
500
511
|
url = match.group(2)
|
|
501
512
|
return f'{LINK[0]}{url}\033\\{Style.Link}{description}{UNDERLINE[1]}{LINK[1]}{FGRESET}'
|
|
@@ -1026,6 +1037,11 @@ def parse(stream):
|
|
|
1026
1037
|
for wrapped_line in wrapped_lines:
|
|
1027
1038
|
yield f"{state.space_left()}{wrapped_line}\n"
|
|
1028
1039
|
|
|
1040
|
+
def terminal_prep(what):
|
|
1041
|
+
if Style.Plaintext:
|
|
1042
|
+
return strip_ansi(what)
|
|
1043
|
+
return what
|
|
1044
|
+
|
|
1029
1045
|
def emit(inp):
|
|
1030
1046
|
buffer = []
|
|
1031
1047
|
flush = False
|
|
@@ -1065,10 +1081,10 @@ def emit(inp):
|
|
|
1065
1081
|
else:
|
|
1066
1082
|
chunk = buffer.pop(0)
|
|
1067
1083
|
|
|
1068
|
-
print(chunk, end="", file=sys.stdout, flush=True)
|
|
1084
|
+
print(terminal_prep(chunk), end="", file=sys.stdout, flush=True)
|
|
1069
1085
|
|
|
1070
1086
|
if len(buffer):
|
|
1071
|
-
print(buffer.pop(0), file=sys.stdout, end="", flush=True)
|
|
1087
|
+
print(terminal_prep(buffer.pop(0)), file=sys.stdout, end="", flush=True)
|
|
1072
1088
|
|
|
1073
1089
|
def ansi2hex(ansi_code):
|
|
1074
1090
|
parts = ansi_code.strip('m').split(";")
|
|
@@ -1127,6 +1143,7 @@ def main():
|
|
|
1127
1143
|
parser.add_argument("-p", "--prompt", default="^.*>\\s+$", help="A PCRE regex prompt to detect (default: %(default)s)")
|
|
1128
1144
|
parser.add_argument("-s", "--scrape", help="Scrape code snippets to a directory SCRAPE")
|
|
1129
1145
|
parser.add_argument("-v", "--version", action="store_true", help="Show version information")
|
|
1146
|
+
parser.add_argument("--strip", action="store_true", help="Just strip the markdown and output plaintext")
|
|
1130
1147
|
args = parser.parse_args()
|
|
1131
1148
|
|
|
1132
1149
|
if args.version:
|
|
@@ -1156,7 +1173,7 @@ def main():
|
|
|
1156
1173
|
|
|
1157
1174
|
for color in ["Dark", "Mid", "Symbol", "Head", "Grey", "Bright"]:
|
|
1158
1175
|
setattr(Style, color, apply_multipliers(style, color, H, S, V))
|
|
1159
|
-
for attr in ['PrettyPad', 'PrettyBroken', 'Margin', 'ListIndent', 'Syntax']:
|
|
1176
|
+
for attr in ['PrettyPad', 'PrettyBroken', 'Margin', 'ListIndent', 'Syntax', 'Plaintext']:
|
|
1160
1177
|
setattr(Style, attr, style.get(attr))
|
|
1161
1178
|
for attr in ['Links', 'Images', 'CodeSpaces', 'Clipboard', 'Logging', 'Timeout', 'Savebrace']:
|
|
1162
1179
|
setattr(state, attr, features.get(attr))
|
|
@@ -1166,6 +1183,7 @@ def main():
|
|
|
1166
1183
|
os.makedirs(args.scrape, exist_ok=True)
|
|
1167
1184
|
state.scrape = args.scrape
|
|
1168
1185
|
|
|
1186
|
+
Style.Plaintext = args.strip
|
|
1169
1187
|
Style.MarginSpaces = " " * Style.Margin
|
|
1170
1188
|
state.WidthArg = int(args.width) or style.get("Width") or 0
|
|
1171
1189
|
state.prompt_regex = re.compile(args.prompt)
|
|
@@ -1231,7 +1249,7 @@ def main():
|
|
|
1231
1249
|
if state.exec_sub:
|
|
1232
1250
|
state.exec_sub.wait()
|
|
1233
1251
|
|
|
1234
|
-
print(RESET, end="")
|
|
1252
|
+
print(terminal_prep(RESET), end="")
|
|
1235
1253
|
sys.exit(state.exit)
|
|
1236
1254
|
|
|
1237
1255
|
if __name__ == "__main__":
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### Before link. [The Link!](link) Should retain color
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|