streamdown 0.18.0__tar.gz → 0.19.0__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.18.0 → streamdown-0.19.0}/PKG-INFO +7 -6
- {streamdown-0.18.0 → streamdown-0.19.0}/README.md +6 -5
- {streamdown-0.18.0 → streamdown-0.19.0}/pyproject.toml +1 -1
- {streamdown-0.18.0 → streamdown-0.19.0}/streamdown/sd.py +13 -6
- streamdown-0.19.0/tests/cjj.mv +4 -0
- streamdown-0.19.0/tests/cjk-table.md +13 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/.gitignore +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/.vimrc +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/24-bit-color.sh +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/LICENSE.MIT +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/assets/logo.png +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/assets/logo.svg +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/configurable.png +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/copyable.png +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/dunder.png +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/error.txt +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/newdir/file_0.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/newdir/file_1.rb +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/newdir/file_2.jl +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/passthrough.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/python-go.png +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/requirements.txt +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/somelog.txt +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/ss-new.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/ss.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/streamdown/__init__.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/streamdown/plugins/README.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/streamdown/plugins/latex.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/streamdown/ss +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/streamdown/ss1 +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/table.png +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/temp.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/test.py +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/test_input.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/README.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/backtick-with-post-spaces.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/block.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/bold_reset_with_link.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/broken-example.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/chinese.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/chunk-buffer.sh +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/cjk-wrap.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/code.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/escape.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/example.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/fizzbuzz.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/inline.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/jimmy_webb.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/line-buffer.sh +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/line-wrap.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/links.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/managerie.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/mandlebrot.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/markdown.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/nested-example.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/outline.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/pvgo_512.jpg +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/pythonvgo.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/strip-chunks.sh +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/table-break.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/table_test.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/test.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/test_input.md +0 -0
- {streamdown-0.18.0 → streamdown-0.19.0}/tests/wm.md +0 -0
|
@@ -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
|

|
|
@@ -15,12 +15,12 @@ $ pip install streamdown
|
|
|
15
15
|

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

|
|
20
20
|
**Tip**: You can make things prettier if you don't mind if this guarantee is broken. See the `PrettyBroken` flag below!
|
|
21
21
|
|
|
22
22
|
### Supports images
|
|
23
|
-
Here's kitty and alacritty.
|
|
23
|
+
Here's kitty and alacritty.
|
|
24
24
|

|
|
25
25
|
|
|
26
26
|
### Supports hyperlinks (OSC 8) and clipboard (OSC 52)
|
|
@@ -29,11 +29,12 @@ Here's kitty and alacritty. Try to do that in glow...
|
|
|
29
29
|
### Supports tables
|
|
30
30
|

|
|
31
31
|
|
|
32
|
-
As well as everything else...
|
|
32
|
+
#### As well as everything else...
|
|
33
33
|

|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
#### ...even CJK
|
|
36
|
+
Compare how streamdown wraps around and spaces this tabular Chinese description of programming languages to the same file using glow.
|
|
37
|
+

|
|
37
38
|
|
|
38
39
|
### Colors are highly (and quickly) configurable for people who care a lot, or just a little.
|
|
39
40
|

|
|
@@ -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,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
| 特性 | Ruby | Python | OCaml |
|
|
2
|
+
|------------------|--------------------------------|--------------------------------|-------------------------------|
|
|
3
|
+
| **设计哲学** | 使编程更加自然和有趣 | 强调代码的可读性和简洁性 | 提供高效的函数式编程功能 |
|
|
4
|
+
| **应用领域** | Web 开发、自动化脚本、原型开发 | Web 开发、数据科学、机器学习、自动化脚本 | 编译器开发、系统编程、金融建模 |
|
|
5
|
+
| **特点** | 动态类型、面向对象、元编程能力强 | 动态类型、面向对象、大量第三方库支持 | 静态类型、函数式编程、模块化、高性能 |
|
|
6
|
+
| **语法示例** | ```ruby<br>class Greeter<br> def initialize(name)<br> @name = name<br> end<br><br> def greet<br> puts "Hello, #{@name}!"<br> end<br>end<br><br>greeter = Greeter.new("World")<br>greeter.greet``` | ```python<br>class Greeter:<br> def __init__(self, name):<br> self.name = name<br><br> def greet(self):<br> print(f"Hello, {self.name}!")<br><br>greeter = Greeter("World")<br>greeter.greet()``` | ```ocaml<br>type greeter = {<br> name: string;<br>}<br><br>let greet {name} =<br> print_endline ("Hello, " ^ name ^ "!")<br><br>let greeter = {name = "World"}<br>let () = greet greeter``` |
|
|
7
|
+
| **性能** | 相对较低,但通过 JRuby、TruffleRuby 可以提高性能 | 适中,通过 Cython、PyPy 可以显著提高性能 | 高,编译后的代码接近 C 语言的性能 |
|
|
8
|
+
| **优点** | 开发速度快,社区活跃 | 丰富的第三方库,应用广泛 | 适合性能关键的应用,编译器优化能力强 |
|
|
9
|
+
| **生态系统** | Ruby on Rails 是最著名的 Web 框架,其他库和工具也很丰富 | 丰富的第三方库,如 NumPy、Pandas、Django、Flask | 相对较少,但有高质量的库,如 Core 和 Async |
|
|
10
|
+
| **学习曲线** | 较平缓,语法灵活,适合初学者 | 平坦,语法清晰,适合初学者 | 较陡峭,需要理解函数式编程概念 |
|
|
11
|
+
| **文档** | 丰富,社区支持好 | 丰富,有大量的教程和资源 | 适中,但社区提供的资源质量高 |
|
|
12
|
+
| **适用场景** | 快速开发、Web 应用、自动化脚本 | 数据科学、机器学习、Web 开发、自动化脚本 | 性能关键的应用、编译器开发、金融建模 |
|
|
13
|
+
|
|
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
|