From b6e87d3d31041531ef4aba83179bac72e35b1747 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sat, 10 Jun 2023 10:54:26 +0000 Subject: [PATCH] perf: markdown render perf --- util/general_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/general_utils.py b/util/general_utils.py index 0b4840ad..25c03eab 100644 --- a/util/general_utils.py +++ b/util/general_utils.py @@ -219,7 +219,7 @@ def render_markdown(markdown_text, image_width=800, image_height=600, font_size= for ii in range(0, font.getsize(line)[0], single_size): # print(ii) _t += single_size - if _t > image_width: + if _t > image_width*0.9: # print("QIEGE") _t=0 cp = cp[:ii//single_size] + '\n' + cp[ii//single_size:] @@ -227,7 +227,7 @@ def render_markdown(markdown_text, image_width=800, image_height=600, font_size= # print(cp) cnt+=1 - height += font_size * cnt + 8 + height += font_size * cnt + 10 markdown_text = '\n'.join(pre_lines) print("Pre process done, height: ", height)