mkdocs-katex-ssr 1.0.2__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-katex-ssr
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: A MkDocs plugin for server-side rendering of KaTeX math.
5
5
  Author-email: RainPPR <2125773894@qq.com>
6
6
  License-Expression: MIT
@@ -150,7 +150,7 @@ class KatexSsrPlugin(BasePlugin):
150
150
 
151
151
  result = json.loads(response_line.decode('utf-8'))
152
152
  if result.get('status') == 'success':
153
- return '<div class="arithmatex">{html}</div>'.format(html=result.get('html'))
153
+ return result.get('html')
154
154
  else:
155
155
  print(f"KaTeX error: {result.get('message')}")
156
156
  except Exception as e:
@@ -167,7 +167,7 @@ class KatexSsrPlugin(BasePlugin):
167
167
  soup = BeautifulSoup(output, 'html.parser')
168
168
  math_elements = soup.find_all(class_='arithmatex')
169
169
  for el in math_elements:
170
- content = el.get_text().strip()
170
+ content = el.get_text(strip=True)
171
171
  display_mode = False
172
172
 
173
173
  if content.startswith('\\(') and content.endswith('\\)'):
@@ -184,9 +184,10 @@ class KatexSsrPlugin(BasePlugin):
184
184
  latex = content
185
185
 
186
186
  rendered_html = self._render_latex(latex, display_mode)
187
- if rendered_html:
188
- new_soup = BeautifulSoup(rendered_html, 'html.parser')
189
- el.replace_with(new_soup)
187
+ new_soup = BeautifulSoup(rendered_html, 'html.parser')
188
+
189
+ el.clear()
190
+ el.append(new_soup)
190
191
 
191
192
  # Assets Injection
192
193
  css_file = self.config['katex_css_filename']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-katex-ssr
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: A MkDocs plugin for server-side rendering of KaTeX math.
5
5
  Author-email: RainPPR <2125773894@qq.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mkdocs-katex-ssr"
7
- version = "1.0.2"
7
+ version = "1.0.3"
8
8
  description = "A MkDocs plugin for server-side rendering of KaTeX math."
9
9
  readme = "README.md"
10
10
  authors = [