Compare commits
7 Commits
2b571987be
...
742eec3a4d
| Author | SHA256 | Date | |
|---|---|---|---|
| 742eec3a4d | |||
| 6dd9da4da0 | |||
| 4d0d83bb0f | |||
| 807690044c | |||
| 34a133d2fb | |||
| 3f85ceb0e8 | |||
| c7082e0296 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -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
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
# 默认忽略的文件
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
6
.idea/blog.iml
generated
6
.idea/blog.iml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module version="4">
|
|
||||||
<component name="PackageRequirementsSettings">
|
|
||||||
<option name="modifyBaseFiles" value="true" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
@@ -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
7
.idea/misc.xml
generated
@@ -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
8
.idea/modules.xml
generated
@@ -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
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user