Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Convert background document to Markdown #25

Merged
merged 5 commits into from
May 31, 2022
Merged

Conversation

garrison
Copy link
Member

@garrison garrison commented May 26, 2022

GitHub now supports equations in Markdown. There are still a few issues in the preview, but it's already looking pretty good.

In any case, here's the quick script that I used to convert from the Jupyter notebook:

import json

with open("quantum_relaxations.ipynb") as f:
    d = json.loads(f.read())

cells = d["cells"]

assert set(c["cell_type"] for c in cells) == set(["markdown"])

md = "\n\n".join("".join(c["source"]) for c in cells)

print(md)

Summary

Details and comments

This is presumably possible now that GitHub supports equations
in Markdown.
https://github.blog/2022-05-19-math-support-in-markdown/

Here's the quick script that I used:

```python
import json

with open("quantum_relaxations.ipynb") as f:
    d = json.loads(f.read())

cells = d["cells"]

assert set(c["cell_type"] for c in cells) == set(["markdown"])

md = "\n\n".join("".join(c["source"]) for c in cells)

print(md)
```
@garrison garrison added the documentation Improvements or additions to documentation label May 26, 2022
@garrison
Copy link
Member Author

garrison commented May 26, 2022

The main thing I've noticed that is odd about the preview (and inconsistent with how equations work in LaTeX and in Jupyter) is that $\{0,1\}$ renders as ${0,1}$. If we want the braces to appear, we have to double escape with two backslashes: $\\{0,1\\}$ renders as $\{0,1\}$.

This is easy enough to change, but I have to wonder if GitHub will notice and "fix" this in the near future.

EDIT: further discussion here

@garrison garrison marked this pull request as ready for review May 31, 2022 17:27
@garrison garrison merged commit efe40fe into main May 31, 2022
@garrison garrison deleted the background-to-markdown branch May 31, 2022 21:02
garrison added a commit that referenced this pull request Jun 1, 2022
There's no reason for a separate file and level of nesting
now that we can put LaTeX equations directly in Markdown.

Follow up to #25
garrison added a commit that referenced this pull request Jun 1, 2022
There's no reason for a separate file and level of nesting
now that we can put LaTeX equations directly in Markdown.

Follow up to #25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant