improve source code comment plugin functionality

This commit is contained in:
binary-husky
2024-07-13 16:03:13 +00:00
parent c1b8c773c3
commit ff899777ce
8 changed files with 29 additions and 16 deletions

View File

@@ -285,6 +285,17 @@ class PythonCodeComment():
return code_block
else:
return code
def get_markdown_block_in_html(self, html):
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, 'lxml')
found_list = soup.find_all("div", class_="markdown-body")
if found_list:
res = found_list[0]
return res.prettify()
else:
return None
def sync_and_patch(self, original, revised):
"""Ensure the number of pre-string empty lines in revised matches those in original."""

View File

@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<style>ADVANCED_CSS</style>
<meta charset="UTF-8">
<title>源文件对比</title>
<style>
@@ -14,12 +15,13 @@
}
.container {
display: flex;
width: 80%;
width: 95%;
height: -webkit-fill-available;
}
.code-container {
flex: 1;
margin: 3px;
padding: 3px;
margin: 0px;
padding: 0px;
border: 1px solid #ccc;
background-color: #f9f9f9;
overflow: auto;
@@ -33,14 +35,10 @@
<body>
<div class="container">
<div class="code-container">
<pre>
REPLACE_CODE_FILE_LEFT
</pre>
</div>
<div class="code-container">
<pre>
REPLACE_CODE_FILE_RIGHT
</pre>
</div>
</div>
</body>