streamdown 0.18.0__py3-none-any.whl → 0.19.0__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.
- streamdown/sd.py +13 -6
- {streamdown-0.18.0.dist-info → streamdown-0.19.0.dist-info}/METADATA +7 -6
- {streamdown-0.18.0.dist-info → streamdown-0.19.0.dist-info}/RECORD +6 -6
- {streamdown-0.18.0.dist-info → streamdown-0.19.0.dist-info}/WHEEL +0 -0
- {streamdown-0.18.0.dist-info → streamdown-0.19.0.dist-info}/entry_points.txt +0 -0
- {streamdown-0.18.0.dist-info → streamdown-0.19.0.dist-info}/licenses/LICENSE.MIT +0 -0
streamdown/sd.py
CHANGED
|
@@ -337,10 +337,10 @@ def ansi_collapse(codelist, inp):
|
|
|
337
337
|
|
|
338
338
|
|
|
339
339
|
def split_text(text):
|
|
340
|
-
return re.split(
|
|
341
|
-
r'(?<=[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF])|(?=[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF])|\s+',
|
|
340
|
+
return [x for x in re.split(
|
|
341
|
+
r'(?<=[\u3000-\u303F\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF])|(?=[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF])|\s+',
|
|
342
342
|
text
|
|
343
|
-
)
|
|
343
|
+
) if x]
|
|
344
344
|
|
|
345
345
|
def text_wrap(text, width = -1, indent = 0, first_line_prefix="", subsequent_line_prefix="", force_truncate=False):
|
|
346
346
|
if width == -1:
|
|
@@ -352,6 +352,7 @@ def text_wrap(text, width = -1, indent = 0, first_line_prefix="", subsequent_lin
|
|
|
352
352
|
current_line = ""
|
|
353
353
|
current_style = []
|
|
354
354
|
|
|
355
|
+
oldword = ''
|
|
355
356
|
for word in words:
|
|
356
357
|
# we apply the style if we see it at the beginning of the word
|
|
357
358
|
codes = extract_ansi_codes(word)
|
|
@@ -360,8 +361,12 @@ def text_wrap(text, width = -1, indent = 0, first_line_prefix="", subsequent_lin
|
|
|
360
361
|
current_style.append(codes.pop(0))
|
|
361
362
|
|
|
362
363
|
if len(word) and visible_length(current_line) + visible_length(word) + 1 <= width: # +1 for space
|
|
363
|
-
|
|
364
|
-
|
|
364
|
+
space = ""
|
|
365
|
+
if len(visible(word)) > 0 and current_line:
|
|
366
|
+
space = " "
|
|
367
|
+
if (":" in visible(word) or cjk_count(word)) and cjk_count(oldword):
|
|
368
|
+
space = ""
|
|
369
|
+
current_line += space + word
|
|
365
370
|
else:
|
|
366
371
|
# Word doesn't fit, finalize the previous line
|
|
367
372
|
prefix = first_line_prefix if not lines else subsequent_line_prefix
|
|
@@ -383,6 +388,8 @@ def text_wrap(text, width = -1, indent = 0, first_line_prefix="", subsequent_lin
|
|
|
383
388
|
if codes:
|
|
384
389
|
current_style = ansi_collapse(current_style, codes)
|
|
385
390
|
|
|
391
|
+
oldword = word
|
|
392
|
+
|
|
386
393
|
if len(lines) < 1:
|
|
387
394
|
return []
|
|
388
395
|
|
|
@@ -834,7 +841,7 @@ def parse(stream):
|
|
|
834
841
|
# This is intentional ... we can get here in llama 4 using
|
|
835
842
|
# a weird thing
|
|
836
843
|
if state.in_list:
|
|
837
|
-
indent = (len(state.list_item_stack) - 1) * Style.ListIndent
|
|
844
|
+
indent = (len(state.list_item_stack) - 1) * Style.ListIndent #+ (len(bullet) - 1)
|
|
838
845
|
wrap_width = state.current_width() - indent - (2 * Style.ListIndent)
|
|
839
846
|
|
|
840
847
|
wrapped_lineList = text_wrap(content, wrap_width, Style.ListIndent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamdown
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.0
|
|
4
4
|
Summary: A streaming markdown renderer for modern terminals with syntax highlighting
|
|
5
5
|
Project-URL: Homepage, https://github.com/kristopolous/Streamdown
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/kristopolous/Streamdown/issues
|
|
@@ -44,12 +44,12 @@ $ pip install streamdown
|
|
|
44
44
|

|
|
45
45
|
|
|
46
46
|
### Provides clean copyable code for long code lines
|
|
47
|
-
|
|
47
|
+
Other renderers inject line breaks when copying code that wraps around. We're better and now you are too!
|
|
48
48
|

|
|
49
49
|
**Tip**: You can make things prettier if you don't mind if this guarantee is broken. See the `PrettyBroken` flag below!
|
|
50
50
|
|
|
51
51
|
### Supports images
|
|
52
|
-
Here's kitty and alacritty.
|
|
52
|
+
Here's kitty and alacritty.
|
|
53
53
|

|
|
54
54
|
|
|
55
55
|
### Supports hyperlinks (OSC 8) and clipboard (OSC 52)
|
|
@@ -58,11 +58,12 @@ Here's kitty and alacritty. Try to do that in glow...
|
|
|
58
58
|
### Supports tables
|
|
59
59
|

|
|
60
60
|
|
|
61
|
-
As well as everything else...
|
|
61
|
+
#### As well as everything else...
|
|
62
62
|

|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
#### ...even CJK
|
|
65
|
+
Compare how streamdown wraps around and spaces this tabular Chinese description of programming languages to the same file using glow.
|
|
66
|
+

|
|
66
67
|
|
|
67
68
|
### Colors are highly (and quickly) configurable for people who care a lot, or just a little.
|
|
68
69
|

|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
streamdown/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
streamdown/sd.py,sha256=
|
|
2
|
+
streamdown/sd.py,sha256=kXN5K_0pBKkDJfIthqUf8WVL1J0fqAamfl3g_mRp_VM,39330
|
|
3
3
|
streamdown/ss,sha256=sel_phpaecrw6WGIHRLROsD7BFShf0rSDHheflwdUn8,277
|
|
4
4
|
streamdown/ss1,sha256=CUVf86_2zeAle2oQCeTfWYqtHBrAFR_UgvptuYMQzFU,3151
|
|
5
5
|
streamdown/plugins/README.md,sha256=KWqYELs9WkKJmuDzYv3cvPlZMkArsNCBUe4XDoTLjLA,1143
|
|
6
6
|
streamdown/plugins/latex.py,sha256=xZMGMdx_Sw4X1piZejXFHfEG9qazU4fGeceiMI0h13Y,648
|
|
7
|
-
streamdown-0.
|
|
8
|
-
streamdown-0.
|
|
9
|
-
streamdown-0.
|
|
10
|
-
streamdown-0.
|
|
11
|
-
streamdown-0.
|
|
7
|
+
streamdown-0.19.0.dist-info/METADATA,sha256=murXBmNpC449_wu6JFtQ5STo4br8eqGVVFD5ljCGxy0,8145
|
|
8
|
+
streamdown-0.19.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
+
streamdown-0.19.0.dist-info/entry_points.txt,sha256=HroKFsFMGf_h9PRTE96NjvjJQWupMW5TGP5RGUr1O_Q,74
|
|
10
|
+
streamdown-0.19.0.dist-info/licenses/LICENSE.MIT,sha256=SnY46EPirUsF20dZDR8HpyVgS2_4Tjxuc6f-4OdqO7U,1070
|
|
11
|
+
streamdown-0.19.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|