-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from terwer/dev
feat:#1 文章详情优化与代码高亮
- Loading branch information
Showing
23 changed files
with
751 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,52 @@ | ||
html.dark body{ | ||
html.dark body { | ||
/* 自定义深色背景颜色 */ | ||
--custom-app-color:#ffffff; | ||
--custom-app-color: #ffffff; | ||
--custom-app-bg-color: #000000; | ||
} | ||
|
||
/* dark table */ | ||
html.dark .post-detail-content-box table { | ||
color: #ffffff; | ||
border-color: #ccc; | ||
} | ||
|
||
html.dark .post-detail-content-box table th { | ||
border-color: #ccc; | ||
background-color: #161616; | ||
} | ||
|
||
html.dark .post-detail-content-box table td { | ||
border-color: #ccc; | ||
background-color: #161616; | ||
} | ||
|
||
/** dark code */ | ||
html.dark .post-detail-content-box .hljs { | ||
color: #ffffff; | ||
background-color: #161616 !important; | ||
border: 1px solid #ccc !important; | ||
} | ||
|
||
html.dark code { | ||
color: #2fd945 !important; | ||
} | ||
|
||
html.dark .hljs-keyword, | ||
html.dark .hljs-selector-tag, | ||
html.dark .hljs-built_in, | ||
html.dark .hljs-name, | ||
html.dark .hljs-tag { | ||
color: #539dc5 !important; | ||
} | ||
|
||
html.dark .post-detail-content-box .hljs-string, | ||
html.dark .post-detail-content-box .hljs-title, | ||
html.dark .post-detail-content-box .hljs-section, | ||
html.dark .post-detail-content-box .hljs-attribute, | ||
html.dark .post-detail-content-box .hljs-literal, | ||
html.dark .post-detail-content-box .hljs-template-tag, | ||
html.dark .post-detail-content-box .hljs-template-variable, | ||
html.dark .post-detail-content-box .hljs-type, | ||
html.dark .post-detail-content-box .hljs-addition { | ||
color: #2fd945 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,9 @@ export default { | |
|
||
<style scoped lang="scss"> | ||
.time { | ||
div{ | ||
padding: 5px 0; | ||
} | ||
margin-bottom: 10px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
import Showdown from "showdown" | ||
|
||
const converter = new Showdown.Converter() | ||
// import Showdown from "showdown" | ||
// const converter = new Showdown.Converter({tables: true}); | ||
|
||
/** | ||
* 渲染Markdown | ||
* @param md | ||
*/ | ||
export function renderHTML(md: string) { | ||
return converter.makeHtml(md); | ||
// @ts-ignore | ||
const lute = Lute.New() | ||
// const renderers = { | ||
// renderText: (node:any, entering:any) => { | ||
// if (entering) { | ||
// console.log(" render text") | ||
// // @ts-ignore | ||
// return [node.Text() + " via Lute", Lute.WalkContinue] | ||
// } | ||
// // @ts-ignore | ||
// return ["", Lute.WalkContinue] | ||
// }, | ||
// renderStrong: (node:any, entering:any) => { | ||
// entering ? console.log(" start render strong") : console.log(" end render strong") | ||
// // @ts-ignore | ||
// return ["", Lute.WalkContinue] | ||
// }, | ||
// renderParagraph: (node:any, entering:any) => { | ||
// entering ? console.log(" start render paragraph") : console.log(" end render paragraph") | ||
// // @ts-ignore | ||
// return ["", Lute.WalkContinue] | ||
// } | ||
// } | ||
// lute.SetJSRenderers({ | ||
// renderers: { | ||
// Md2HTML: renderers | ||
// }, | ||
// }) | ||
// return converter.makeHtml(md); | ||
return lute.MarkdownStr("", md) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @function unescapeHTML 还原html脚本 < > & " ' | ||
* @param a - | ||
* 字符串 | ||
*/ | ||
export const unescapeHTML = function (a: string) { | ||
a = "" + a; | ||
return a.replace(/\&/g, "&").replace(/\</g, "<") | ||
.replace(/\>/g, ">") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
9b4a936
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
jvue-front – ./
jvue-front.vercel.app
jvue-front-terwergreen.vercel.app
terwer.space
www.terwer.space
jvue-front-git-main-terwergreen.vercel.app