Improved instruct style (with syntax highlighting & LaTeX rendering) (#5936)

This commit is contained in:
oobabooga 2024-04-26 10:13:11 -03:00 committed by GitHub
parent 9c04365f54
commit 6761b5e7c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 1358 additions and 51 deletions

View file

@ -57,6 +57,14 @@ def convert_to_markdown(string):
# Code
string = string.replace('\\begin{code}', '```')
string = string.replace('\\end{code}', '```')
string = string.replace('\\begin{align*}', '$$')
string = string.replace('\\end{align*}', '$$')
string = string.replace('\\begin{align}', '$$')
string = string.replace('\\end{align}', '$$')
string = string.replace('\\begin{equation}', '$$')
string = string.replace('\\end{equation}', '$$')
string = string.replace('\\begin{equation*}', '$$')
string = string.replace('\\end{equation*}', '$$')
string = re.sub(r"(.)```", r"\1\n```", string)
result = ''