Compare commits

...

7 Commits

Author SHA256 Message Date
742eec3a4d Merge develop into main 2025-07-27 18:24:30 +08:00
6dd9da4da0 fix markdown 'code block' 2025-07-27 18:23:12 +08:00
4d0d83bb0f Merge develop into main 2025-07-27 18:21:12 +08:00
807690044c Remove .idea directory from Git tracking 2025-07-27 18:20:53 +08:00
34a133d2fb git test 2025-07-27 17:39:14 +08:00
3f85ceb0e8 Merge develop into main 2025-07-27 17:27:46 +08:00
c7082e0296 fix markdown packages && fix markdown view in webview 2025-07-27 17:27:17 +08:00
11 changed files with 35 additions and 45 deletions

2
.gitignore vendored
View File

@@ -166,7 +166,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ .idea/
# Ruff stuff: # Ruff stuff:
.ruff_cache/ .ruff_cache/

8
.idea/.gitignore generated vendored
View File

@@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
.idea/blog.iml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="PackageRequirementsSettings">
<option name="modifyBaseFiles" value="true" />
</component>
</module>

View File

@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml generated
View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12 (blog) (2)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (blog) (2)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/blog.iml" filepath="$PROJECT_DIR$/.idea/blog.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1 +1 @@
init feature/base-view branch git test

View File

@@ -18,6 +18,7 @@ class Post(models.Model):
def get_markdown_content(self): def get_markdown_content(self):
import re import re
import emoji
content = self.content content = self.content
media_url = settings.MEDIA_URL.rstrip('/') media_url = settings.MEDIA_URL.rstrip('/')
@@ -60,4 +61,10 @@ class Post(models.Model):
content content
) )
return mark_safe(markdown.markdown(content)) # 先转换markdown到HTML
html_content = markdown.markdown(content)
# 将emoji shortcode转换为实际的emoji字符
html_content = emoji.emojize(html_content, language='alias')
return mark_safe(html_content)

View File

@@ -24,6 +24,30 @@
display: block; display: block;
margin: 10px 0; margin: 10px 0;
} }
.post-content pre {
background-color: #f4f4f4;
border: 1px solid #ddd;
border-radius: 4px;
padding: 10px;
overflow-x: auto;
margin: 10px 0;
}
.post-content code {
font-family: 'Courier New', Courier, monospace;
background-color: #f4f4f4;
padding: 2px 4px;
border-radius: 3px;
font-size: 0.9em;
}
.post-content pre code {
background-color: transparent;
padding: 0;
border-radius: 0;
font-size: 0.9em;
}
</style> </style>
<div class="post-content">{{ post.get_markdown_content }}</div> <div class="post-content">{{ post.get_markdown_content }}</div>
</div> </div>

View File

@@ -15,7 +15,7 @@ idna==3.10
ipython==9.4.0 ipython==9.4.0
ipython_pygments_lexers==1.1.1 ipython_pygments_lexers==1.1.1
jedi==0.19.2 jedi==0.19.2
Markdown==3.8.2 Markdown
martor==1.6.45 martor==1.6.45
matplotlib-inline==0.1.7 matplotlib-inline==0.1.7
numpy==2.3.2 numpy==2.3.2