code dem fix
This commit is contained in:
parent
28eae2f80e
commit
9643e1c25f
@ -7,6 +7,7 @@ protobuf==3.18
|
||||
transformers>=4.27.1
|
||||
scipdf_parser>=0.52
|
||||
python-markdown-math
|
||||
pymdown-extensions
|
||||
websocket-client
|
||||
beautifulsoup4
|
||||
prompt_toolkit
|
||||
|
@ -195,11 +195,11 @@ def markdown_convertion(txt):
|
||||
find_equation_pattern = r'<script type="math/tex(?:.*?)>(.*?)</script>'
|
||||
|
||||
txt = fix_markdown_indent(txt)
|
||||
txt = fix_code_segment_indent(txt)
|
||||
# txt = fix_code_segment_indent(txt)
|
||||
if is_equation(txt): # 有$标识的公式符号,且没有代码段```的标识
|
||||
# convert everything to html format
|
||||
split = markdown.markdown(text='---')
|
||||
convert_stage_1 = markdown.markdown(text=txt, extensions=['sane_lists', 'tables', 'mdx_math', 'fenced_code'],
|
||||
convert_stage_1 = markdown.markdown(text=txt, extensions=['sane_lists', 'tables', 'mdx_math', 'pymdownx.superfences'],
|
||||
extension_configs=markdown_extension_configs)
|
||||
convert_stage_1 = markdown_bug_hunt(convert_stage_1)
|
||||
# 1. convert to easy-to-copy tex (do not render math)
|
||||
@ -209,7 +209,7 @@ def markdown_convertion(txt):
|
||||
# cat them together
|
||||
return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
|
||||
else:
|
||||
return pre + markdown.markdown(txt, extensions=['sane_lists', 'tables', 'fenced_code', 'codehilite']) + suf
|
||||
return pre + markdown.markdown(txt, extensions=['sane_lists', 'tables', 'pymdownx.superfences', 'codehilite']) + suf
|
||||
|
||||
|
||||
def close_up_code_segment_during_stream(gpt_reply):
|
||||
@ -250,7 +250,7 @@ def format_io(self, y):
|
||||
if gpt_reply is not None: gpt_reply = close_up_code_segment_during_stream(gpt_reply)
|
||||
# process
|
||||
y[-1] = (
|
||||
None if i_ask is None else markdown.markdown(i_ask, extensions=['fenced_code', 'tables']),
|
||||
None if i_ask is None else markdown.markdown(i_ask, extensions=['pymdownx.superfences', 'tables']),
|
||||
None if gpt_reply is None else markdown_convertion(gpt_reply)
|
||||
)
|
||||
return y
|
||||
|
@ -73,6 +73,50 @@ md = """
|
||||
"""
|
||||
|
||||
|
||||
md = """
|
||||
要将NTFS格式转换为ext4格式,需要执行以下步骤:
|
||||
|
||||
1. 首先,确保你的NTFS分区已经挂载。可以使用`df -lh`命令来检查。
|
||||
|
||||
2. 创建一个ext4文件系统。打开终端并执行以下命令:
|
||||
```
|
||||
sudo mkfs.ext4 /dev/sdc1
|
||||
```
|
||||
注意将`/dev/sdc1`替换为你要转换的NTFS分区的设备名称。
|
||||
|
||||
3. 等待文件系统创建完成。这可能需要一些时间。
|
||||
|
||||
4. 将新的ext4文件系统挂载到指定的挂载点。执行以下命令:
|
||||
```
|
||||
sudo mkdir /mnt/mydrive
|
||||
sudo mount -t ext4 /dev/sdc1 /mnt/mydrive
|
||||
```
|
||||
注意将`/mnt/mydrive`替换为你要挂载的目录。
|
||||
|
||||
5. 现在,可以将数据从原始NTFS分区复制到新的ext4分区。执行以下命令:
|
||||
```
|
||||
sudo rsync -avxP /media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e /mnt/mydrive
|
||||
```
|
||||
注意将`/media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e`替换为你的原始NTFS分区的挂载点。
|
||||
|
||||
6. 等待数据复制完成。这可能需要一些时间,具体取决于数据量。
|
||||
|
||||
7. 确认数据已经成功复制到新的ext4分区后,可以卸载原始NTFS分区。执行以下命令:
|
||||
```
|
||||
sudo umount /media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e
|
||||
```
|
||||
|
||||
8. 现在,你可以将新的ext4分区重新挂载到原来的位置。执行以下命令:
|
||||
```
|
||||
sudo umount /mnt/mydrive
|
||||
sudo mount -t ext4 /dev/sdc1 /media/fuqingxu/eb63a8fa-cee9-48a5-9f05-b1388c3fda9e
|
||||
```
|
||||
|
||||
完成上述步骤后,NTFS分区将被转换为ext4格式,并且数据将被复制到新的分区中。请确保在执行任何操作之前备份重要数据。
|
||||
|
||||
|
||||
"""
|
||||
|
||||
def validate_path():
|
||||
import os, sys
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user