Skip to content

Commit

Permalink
Merge pull request #110 from terwer/dev
Browse files Browse the repository at this point in the history
feat: #84 平台配置帮助文档
  • Loading branch information
terwer authored Sep 28, 2022
2 parents a5bb796 + ad911e0 commit a0b2c86
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
7 changes: 4 additions & 3 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "思源笔记辅助工具",
"version": "1.0.0",
"name": "思源笔记发布辅助工具",
"version": "0.0.3",
"manifest_version": 3,
"author": "terwer",
"description": "思源笔记辅助工具,支持博客式只读浏览,多平台文章发布。",
"description": "思源笔记发布辅助工具,支持博客式只读浏览,多平台文章发布。",
"background": {
"service_worker": "background.js"
},
Expand All @@ -17,6 +17,7 @@
"resources": [
"blog/index.html",
"detail/index.html",
"publish/index.html",
"index.html"
],
"matches": [
Expand Down
10 changes: 6 additions & 4 deletions src/components/tab/main/CommonBlogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,15 @@ const doPublish = async () => {
// 文章标题
let fmtTitle = removeTitleNumber(formData.title)
// 发布内容
const md = await getPageMd(siyuanData.pageId);
let content = md
let content
const data = await getPageMd(siyuanData.pageId);
const md = data.content
if (PageType.Html == commonblogCfg.pageType) {
const html = mdToHtml(content)
const html = mdToHtml(md)
content = removeWidgetTag(html)
} else {
content = removeMdWidgetTag(content)
// logUtil.logWarn("md=>", md)
content = removeMdWidgetTag(md)
}
// ===============================
const post = new Post()
Expand Down
10 changes: 6 additions & 4 deletions src/components/tab/main/MetaweblogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,15 @@ const doPublish = async () => {
// 标题处理
let fmtTitle = removeTitleNumber(formData.title)
// 发布内容
const md = await getPageMd(siyuanData.pageId);
let content = md
let content
const data = await getPageMd(siyuanData.pageId);
const md = data.content
if (PageType.Html == metaweblogCfg.pageType) {
const html = mdToHtml(content)
const html = mdToHtml(md)
content = removeWidgetTag(html)
} else {
content = removeMdWidgetTag(content)
// logUtil.logWarn("md=>", md)
content = removeMdWidgetTag(md)
}
// ===============================
const post = new Post()
Expand Down
7 changes: 5 additions & 2 deletions src/components/tab/main/VuepressMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,12 @@ async function initPage() {
convertAttrToYAML()
// 文章内容同步到YAMl
// 发布内容
let content
const data = await getPageMd(siyuanData.value.pageId);
const md = removeMdWidgetTag(data.content)
vuepressData.value.vuepressContent = md;
const md = data.content
content = removeMdWidgetTag(md)
vuepressData.value.vuepressContent = content;
vuepressData.value.vuepressFullContent = vuepressData.value.formatter + "\n" + vuepressData.value.vuepressContent;
// 发布状态
Expand Down
6 changes: 4 additions & 2 deletions src/lib/htmlUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// const converter = new showdown.Converter();

import {render} from "./markdownUtil";
import logUtil from "./logUtil";

/**
* 移除标题数字
Expand All @@ -23,7 +24,8 @@ export function removeTitleNumber(str: string) {
* @returns {*|string} 删除后的字符
*/
export function removeWidgetTag(str: string) {
let newstr = str
let newstr = str.toString()
// logUtil.logWarn("newstr=>", newstr)

// 旧版发布挂件
const publisherRegex = /<iframe.*src="\/widgets\/publisher.*<\/iframe>/g;
Expand All @@ -49,7 +51,7 @@ export function removeWidgetTag(str: string) {
* @returns {*|string} 删除后的字符
*/
export function removeMdWidgetTag(str: string) {
let newstr = str
let newstr = str.toString()

const mdH1Rehex = /#\s[0-9]+.*/g
newstr = newstr.replace(mdH1Rehex, "")
Expand Down

1 comment on commit a0b2c86

@vercel
Copy link

@vercel vercel bot commented on a0b2c86 Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.