-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowLaTeXImage.py
More file actions
33 lines (31 loc) · 902 Bytes
/
showLaTeXImage.py
File metadata and controls
33 lines (31 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pageSource = r"""
<!DOCTYPE html>
<html>
<head>
<style>
.center {
padding: 10px 0;
text-align: center;
}
</style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>MathJax example</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js">
</script>
</head>
<body>
<div class = "center">
<p>
</p>
</div>
</body>
</html>
"""
def convertHtml(string="<Showing the LaTeX converted image>"):
from bs4 import BeautifulSoup
soup = BeautifulSoup(pageSource, features='lxml')
soup.p.string = string
return str(soup)