添加5种alerts功能样式
具体可参考下面的链接 https://docs.github.com/zh/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
This commit is contained in:
parent
0cc2674a4d
commit
e0c5923dcb
20
Gmeek.py
20
Gmeek.py
@ -137,6 +137,26 @@ class GMEEK():
|
|||||||
post_body=re.sub(r'<math-renderer.*?>','',post_body)
|
post_body=re.sub(r'<math-renderer.*?>','',post_body)
|
||||||
post_body=re.sub(r'</math-renderer>','',post_body)
|
post_body=re.sub(r'</math-renderer>','',post_body)
|
||||||
issue["script"]=issue["script"]+'<script>MathJax = {tex: {inlineMath: [["$", "$"]]}};</script><script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>'
|
issue["script"]=issue["script"]+'<script>MathJax = {tex: {inlineMath: [["$", "$"]]}};</script><script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>'
|
||||||
|
|
||||||
|
if '<p class="markdown-alert-title">' in post_body:
|
||||||
|
issue["style"]=issue["style"]+'.markdown-alert{padding:0.5rem 1rem;margin-bottom:1rem;border-left:.25em solid var(--borderColor-default,var(--color-border-default));}.markdown-alert .markdown-alert-title {display:flex;font-weight:var(--base-text-weight-medium,500);align-items:center;line-height:1;}.markdown-alert>:first-child {margin-top:0;}.markdown-alert>:last-child {margin-bottom:0;}'
|
||||||
|
alerts = {
|
||||||
|
'note': 'accent',
|
||||||
|
'tip': 'success',
|
||||||
|
'important': 'done',
|
||||||
|
'warning': 'attention',
|
||||||
|
'caution': 'danger'
|
||||||
|
}
|
||||||
|
|
||||||
|
for alert, style in alerts.items():
|
||||||
|
if f'markdown-alert-{alert}' in post_body:
|
||||||
|
issue["style"] += (
|
||||||
|
f'.markdown-alert.markdown-alert-{alert} {{'
|
||||||
|
f'border-left-color:var(--borderColor-{style}-emphasis, var(--color-{style}-emphasis));'
|
||||||
|
f'background-color:var(--color-{style}-subtle);}}'
|
||||||
|
f'.markdown-alert.markdown-alert-{alert} .markdown-alert-title {{'
|
||||||
|
f'color: var(--fgColor-{style},var(--color-{style}-fg));}}'
|
||||||
|
)
|
||||||
|
|
||||||
postBase["postTitle"]=issue["postTitle"]
|
postBase["postTitle"]=issue["postTitle"]
|
||||||
postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"]
|
postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user