-
Checklist
How did you create the site?Generated from DescriptionI write this: $\mathbf{x}_{t}$ and $\mathbf{g}_{t}$Here is what it should look like: Now I am going to paste this line, and github will fail to render it: $\mathbf{x}{t}$ and $\mathbf{g}{t}$ I have the same issue with my page, where this also fails to render this. And I am not sure how to fix this. Operations you have already triedThe following works: $\mathbf{x}_t$ and $\mathbf{g}_t$However that makes it impossible to do this: $\mathbf{x}_{t+1}$ and $\mathbf{g}_{t-1}$Which doesn't render: $\mathbf{x}{t+1}$ and $\mathbf{g}{t-1}$ Anything else?No response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
alright, I have fixed this via the following method: So my workflow is, I have a "raw posts" directory where I write normal markdown, then I run a script which embeds all latex into {::nomarkdown} and saves to "_posts" directory. Here is the embedding part: def wrap_math(content: str):
"""
Wraps $...$ and $$...$$ into {::nomarkdown}
"""
# for $..$
p1 = r'\$[^\n\$]+\$'
# for $$..$$
p2 = r'\$\$[\s\S]*?\$\$'
pattern = re.compile(f'({p2})|({p1})')
def replacer(match):
return f"{{::nomarkdown}}{match.group(0)}{{:/nomarkdown}}"
return pattern.sub(replacer, content)so for example I do this with open(Path("raw_posts") / name, "r", encoding='utf8') as f:
md = f.read()
# wrap math
md = wrap_math(md)
with open(Path("_posts") / name, "w", encoding='utf8') as f:
f.write(md) |
Beta Was this translation helpful? Give feedback.
alright, I have fixed this via the following method:
So my workflow is, I have a "raw posts" directory where I write normal markdown, then I run a script which embeds all latex into {::nomarkdown} and saves to "_posts" directory. Here is the embedding part:
so for example I do this