mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-10 23:38:48 +08:00
Compare commits
37 Commits
v2.3.1
...
renovate/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59da2d1ff0 | ||
|
|
8991adcd15 | ||
|
|
1b2e3b534d | ||
|
|
d85368cb4f | ||
|
|
8b4194f5ae | ||
|
|
ab3423a697 | ||
|
|
504259b862 | ||
|
|
b05d90e15b | ||
|
|
f6e71388f1 | ||
|
|
1c9a7a8668 | ||
|
|
314f47f8af | ||
|
|
be06f694a5 | ||
|
|
c23ada95ff | ||
|
|
2632cb1938 | ||
|
|
77616468a4 | ||
|
|
41eb86cd2b | ||
|
|
5fe5ddfa61 | ||
|
|
82cc2a3df4 | ||
|
|
b5596d76b6 | ||
|
|
d2c2746420 | ||
|
|
ef1ed54be7 | ||
|
|
e3a3cf5ff6 | ||
|
|
4f4ad71d09 | ||
|
|
3b32e76f65 | ||
|
|
056b792519 | ||
|
|
de98442b3c | ||
|
|
8bf24877bf | ||
|
|
ad546bfb6c | ||
|
|
bac929d894 | ||
|
|
ab1c043931 | ||
|
|
5afb09a715 | ||
|
|
df79dcf694 | ||
|
|
33a60420a4 | ||
|
|
c7dba6d5de | ||
|
|
ed596a7403 | ||
|
|
7f28e6ada1 | ||
|
|
df10f96a65 |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
ko_fi: jaywcjlove
|
||||
buy_me_a_coffee: jaywcjlove
|
||||
custom: ["https://www.paypal.me/kennyiseeyou", "https://jaywcjlove.github.io/#/sponsor"]
|
||||
110
.github/workflows/ci.yml
vendored
110
.github/workflows/ci.yml
vendored
@@ -6,17 +6,18 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npm run doc
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: webiste
|
||||
path: |
|
||||
@@ -40,7 +41,7 @@ jobs:
|
||||
uses: jaywcjlove/changelog-generator@main
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
commit_message: ${{ github.event.head_commit.message }} ${{steps.tag_version.outputs.tag}}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -66,8 +67,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: webiste
|
||||
path: website/build
|
||||
@@ -98,33 +99,33 @@ jobs:
|
||||
docker tag wxmp ${{ secrets.DOCKER_USER }}/wxmp:${{needs.build.outputs.version}}
|
||||
docker push ${{ secrets.DOCKER_USER }}/wxmp:${{needs.build.outputs.version}}
|
||||
|
||||
# Create Docker Image in GitHub
|
||||
- name: Login to GitHub registry
|
||||
run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
# # Create Docker Image in GitHub
|
||||
# - name: Login to GitHub registry
|
||||
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
|
||||
- name: Build docker image
|
||||
working-directory: website
|
||||
run: docker build -t ghcr.io/jaywcjlove/wxmp:latest .
|
||||
# - name: Build docker image
|
||||
# working-directory: website
|
||||
# run: docker build -t ghcr.io/jaywcjlove/wxmp:latest .
|
||||
|
||||
- name: Publish to GitHub registry
|
||||
run: docker push ghcr.io/jaywcjlove/wxmp:latest
|
||||
# - name: Publish to GitHub registry
|
||||
# run: docker push ghcr.io/jaywcjlove/wxmp:latest
|
||||
|
||||
- name: Tag docker image (beta) and publish to GitHub registry
|
||||
if: needs.build.outputs.successful
|
||||
run: |
|
||||
echo "version: v${{ needs.build.outputs.version }}"
|
||||
docker tag ghcr.io/jaywcjlove/wxmp:latest ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
|
||||
docker push ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
|
||||
# - name: Tag docker image (beta) and publish to GitHub registry
|
||||
# if: needs.build.outputs.successful
|
||||
# run: |
|
||||
# echo "version: v${{ needs.build.outputs.version }}"
|
||||
# docker tag ghcr.io/jaywcjlove/wxmp:latest ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
|
||||
# docker push ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
|
||||
|
||||
build_windows:
|
||||
needs: [build]
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
|
||||
- name: Install
|
||||
run: npm install --build-from-source
|
||||
@@ -133,7 +134,7 @@ jobs:
|
||||
- run: npm run build
|
||||
# - run: npm run electron
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: webiste
|
||||
path: website/build
|
||||
@@ -143,8 +144,11 @@ jobs:
|
||||
run: npm run deps
|
||||
|
||||
- run: npm run build:app
|
||||
- working-directory: electron/app/dist
|
||||
run: ls -R
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: needs.build.outputs.successful == 'true'
|
||||
with:
|
||||
name: wxmp-windows
|
||||
path: |
|
||||
@@ -155,16 +159,16 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
|
||||
- run: npm install
|
||||
- run: npm run hoist
|
||||
- run: npm run build
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: webiste
|
||||
path: website/build
|
||||
@@ -174,8 +178,11 @@ jobs:
|
||||
run: npm run deps
|
||||
|
||||
- run: npm run build:app
|
||||
- working-directory: electron/app/dist
|
||||
run: ls -R
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: needs.build.outputs.successful == 'true'
|
||||
with:
|
||||
name: wxmp-macos
|
||||
path: |
|
||||
@@ -186,16 +193,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
- run: npm install
|
||||
- run: npm run hoist
|
||||
- run: npm run build
|
||||
# - run: npm run electron
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: webiste
|
||||
path: website/build
|
||||
@@ -205,8 +212,11 @@ jobs:
|
||||
run: npm run deps
|
||||
|
||||
- run: npm run build:app
|
||||
- working-directory: electron/app/dist
|
||||
run: ls -R
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: needs.build.outputs.successful == 'true'
|
||||
with:
|
||||
name: wxmp-linux
|
||||
path: |
|
||||
@@ -216,26 +226,26 @@ jobs:
|
||||
|
||||
create_release:
|
||||
needs: [build, build_windows, build_macos, build_linux]
|
||||
if: needs.build.outputs.successful
|
||||
if: needs.build.outputs.successful == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wxmp-linux
|
||||
path: dist/linux
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wxmp-macos
|
||||
path: dist/macos
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wxmp-windows
|
||||
path: dist/windows
|
||||
@@ -254,8 +264,9 @@ jobs:
|
||||
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: needs.build.outputs.successful
|
||||
if: needs.build.outputs.successful == 'true'
|
||||
with:
|
||||
allowUpdates: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: ${{ steps.changelog.outputs.tag }}
|
||||
tag: ${{ steps.changelog.outputs.tag }}
|
||||
@@ -288,17 +299,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 4
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- run: echo "outputs.version - ${{ needs.build.outputs.create_tag_version }}"
|
||||
|
||||
- uses: dev-drprasad/delete-tag-and-release@v0.2.0
|
||||
if: needs.build.outputs.successful
|
||||
- uses: dev-drprasad/delete-tag-and-release@v1.1
|
||||
if: needs.build.outputs.successful == 'true'
|
||||
with:
|
||||
delete_release: true
|
||||
repo: jaywcjlove/wxmp
|
||||
tag_name: '${{ needs.build.outputs.create_tag_version }}'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
<h1 align="center">微信公众号 Markdown 编辑器</h1>
|
||||
</div>
|
||||
|
||||
[](https://jaywcjlove.github.io/#/sponsor)
|
||||
[](https://github.com/jaywcjlove/wxmp/actions/workflows/ci.yml)
|
||||
|
||||
[](https://jaywcjlove.github.io/wxmp)
|
||||
|
||||
微信公众号文章 Markdown 在线编辑器,使用 markdown 语法创建一篇简介美观大方的微信公众号图文。由于发版本麻烦,和一些功能无法扩展停滞开发了,未来不再开发 Chrome 的插件(暂存在 chrome 分支),通过 web 版本定制更丰富的功能。
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "wxmp",
|
||||
"description": "微信公众号 Markdown 编辑器",
|
||||
"homepage": "https://github.com/jaywcjlove/wxmp.git",
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.0",
|
||||
"main": "main.js",
|
||||
"author": "Kenny Wong <398188662@qq.com>",
|
||||
"private": true,
|
||||
@@ -18,13 +18,13 @@
|
||||
"build": "npm run copy && cross-env NODE_ENV=production electron-builder build --publish=never --config config.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wcj/wxmp-main": "2.3.1"
|
||||
"@wcj/wxmp-main": "2.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wcj/wxmp-preload": "2.3.1",
|
||||
"cpy-cli": "4.2.0",
|
||||
"electron": "19.0.5",
|
||||
"@wcj/wxmp-preload": "2.4.0",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"electron": "20.1.3",
|
||||
"electron-builder": "23.3.3",
|
||||
"website": "2.3.1"
|
||||
"website": "2.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "@wcj/wxmp-main",
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.0",
|
||||
"main": "./lib/index.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsbb build --disable-babel --file-names src/index.ts",
|
||||
"watch": "tsbb watch --disable-babel --file-names src/index.ts"
|
||||
"build": "tsbb build",
|
||||
"watch": "tsbb watch"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"electron": "19.0.5"
|
||||
"electron": "20.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "@wcj/wxmp-preload",
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.0",
|
||||
"main": "./lib/index.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsbb build --disable-babel --file-names src/index.ts",
|
||||
"watch": "tsbb watch --disable-babel --file-names src/index.ts"
|
||||
"build": "tsbb build",
|
||||
"watch": "tsbb watch"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"electron": "19.0.5"
|
||||
"electron": "20.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.0",
|
||||
"packages": ["website", "electron/*"]
|
||||
}
|
||||
|
||||
11
package.json
11
package.json
@@ -9,18 +9,19 @@
|
||||
"version": "lerna version --exact --force-publish --no-push --no-git-tag-version",
|
||||
"prepare": "husky install",
|
||||
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
||||
"pretty-quick": "pretty-quick --staged",
|
||||
"hoist": "lerna bootstrap --hoist",
|
||||
"clean": "lerna clean --yes"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@lerna/legacy-package-management": "^8.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"husky": "^8.0.1",
|
||||
"lerna": "5.5.1",
|
||||
"prettier": "^2.7.1",
|
||||
"pretty-quick": "~3.1.3",
|
||||
"tsbb": "^3.7.5"
|
||||
"lerna": "^8.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"react": "~18.2.0",
|
||||
"react-dom": "~18.2.0",
|
||||
"tsbb": "~4.4.0"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
||||
@@ -20,6 +20,8 @@ export default (conf: Configuration, env: 'development' | 'production', options:
|
||||
}),
|
||||
);
|
||||
|
||||
/** https://github.com/kktjs/kkt/issues/446 */
|
||||
conf.ignoreWarnings = [{ module: /node_modules[\\/]parse5[\\/]/ }];
|
||||
conf.module!.exprContextCritical = false;
|
||||
if (env === 'production') {
|
||||
conf.output = { ...conf.output, publicPath: './' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "website",
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "kkt start",
|
||||
@@ -25,33 +25,31 @@
|
||||
"@uiw/codemirror-theme-xcode": "^4.11.6",
|
||||
"@uiw/react-back-to-top": "^1.2.0",
|
||||
"@uiw/react-github-corners": "^1.5.15",
|
||||
"@uiw/react-markdown-editor": "^5.7.0",
|
||||
"@uiw/react-markdown-editor": "^6.0.0",
|
||||
"@wcj/dark-mode": "^1.0.15",
|
||||
"css-tree": "^2.2.1",
|
||||
"react": "^18.2.0",
|
||||
"react-code-preview-layout": "^2.0.4",
|
||||
"react-dom": "^18.2.0",
|
||||
"react": "~18.2.0",
|
||||
"react-dom": "~18.2.0",
|
||||
"react-hot-toast": "^2.3.0",
|
||||
"react-router-dom": "^6.3.0",
|
||||
"rehype-attr": "^2.0.8",
|
||||
"rehype-ignore": "^1.0.1",
|
||||
"rehype-prism-plus": "^1.5.0",
|
||||
"rehype-raw": "^6.1.1",
|
||||
"rehype-stringify": "^9.0.3",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"remark-parse": "^10.0.1",
|
||||
"remark-rehype": "^10.1.0",
|
||||
"styled-components": "^5.3.5",
|
||||
"unified": "^10.1.2"
|
||||
"react-router-dom": "^7.0.0",
|
||||
"rehype-attr": "^3.0.0",
|
||||
"rehype-ignore": "^2.0.0",
|
||||
"rehype-prism-plus": "^2.0.0",
|
||||
"rehype-raw": "^7.0.0",
|
||||
"rehype-stringify": "^10.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.0.0",
|
||||
"styled-components": "~6.1.0",
|
||||
"unified": "^11.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kkt/less-modules": "^7.2.0",
|
||||
"@kkt/raw-modules": "^7.2.0",
|
||||
"@kkt/scope-plugin-options": "^7.2.0",
|
||||
"@types/css-tree": "^1.0.7",
|
||||
"@types/css-tree": "^2.3.1",
|
||||
"@types/react": "^18.0.17",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/styled-components": "^5.1.25",
|
||||
"kkt": "^7.2.0",
|
||||
"markdown-react-code-preview-loader": "^2.1.2"
|
||||
},
|
||||
|
||||
@@ -13,16 +13,22 @@ const Button = styled.button`
|
||||
const CopyView: React.FC<{ command: ICommand; editorProps: IMarkdownEditor & ToolBarProps }> = (props) => {
|
||||
const { editorProps } = props;
|
||||
const handleClick = () => {
|
||||
const dom = editorProps.preview.current;
|
||||
dom?.focus();
|
||||
window.getSelection()?.removeAllRanges();
|
||||
let range = document.createRange();
|
||||
range.setStartBefore(dom?.firstChild!);
|
||||
range.setEndAfter(dom?.lastChild!);
|
||||
window.getSelection()?.addRange(range);
|
||||
document.execCommand(`copy`);
|
||||
window.getSelection()?.removeAllRanges();
|
||||
toast.success(<div>复制成功!去公众号编辑器复制吧!</div>);
|
||||
const dom: HTMLDivElement | null = editorProps.preview.current;
|
||||
if (!dom) {
|
||||
toast.error(<div>dom is null</div>);
|
||||
return;
|
||||
}
|
||||
dom.focus();
|
||||
const htmlContent = dom.innerHTML;
|
||||
navigator.clipboard
|
||||
.writeText(htmlContent)
|
||||
.then(() => {
|
||||
toast.success(<div>复制成功!去公众号编辑器粘贴吧!</div>);
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.error(<div>{JSON.stringify(err)}</div>);
|
||||
console.error('Failed to copy: ', err);
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Button type="button" onClick={handleClick}>
|
||||
|
||||
@@ -4,7 +4,7 @@ import styled from 'styled-components';
|
||||
|
||||
const Link = styled(NavLink)`
|
||||
font-size: 0.8rem;
|
||||
line-height: 0.8rem;
|
||||
line-height: 0.7rem;
|
||||
text-decoration: none;
|
||||
padding: 0.18rem 0.3rem;
|
||||
&:hover {
|
||||
|
||||
@@ -12,7 +12,7 @@ const Select = styled.select`
|
||||
padding: 0 0.2rem 0 0.2rem;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: 0.8rem;
|
||||
font-size: 0.7rem;
|
||||
outline: none;
|
||||
height: 1.15rem;
|
||||
cursor: inherit;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import MarkdownEditor, { getCommands } from '@uiw/react-markdown-editor';
|
||||
import { useContext } from 'react';
|
||||
// @ts-ignore
|
||||
import { EditorView } from '@codemirror/view';
|
||||
import { Preview } from './Preview';
|
||||
import { copy } from '../../commands/copy';
|
||||
|
||||
@@ -5,7 +5,7 @@ a {
|
||||
|
||||
h1 {
|
||||
color: inherit;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ h4 {
|
||||
|
||||
p {
|
||||
color: initial;
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ h1 {
|
||||
line-height: 1.75;
|
||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin: 2em auto 1em;
|
||||
padding: 0 1em;
|
||||
@@ -63,7 +63,7 @@ li {
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
padding: 0.5em 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
|
||||
@@ -11,7 +11,7 @@ h1 {
|
||||
line-height: 1.75;
|
||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin: 2em auto 1em;
|
||||
padding: 0 1em;
|
||||
@@ -63,7 +63,7 @@ li {
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
padding: 0.5em 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
|
||||
@@ -11,7 +11,7 @@ h1 {
|
||||
line-height: 1.15;
|
||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin: 2em auto 1em;
|
||||
padding: 0 1em 0.3em 1em;
|
||||
@@ -37,7 +37,7 @@ h3 {
|
||||
line-height: 1.2;
|
||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin: 2em 8px 0.75em 0;
|
||||
padding-left: 8px;
|
||||
@@ -59,7 +59,7 @@ li {
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
padding: 0.5em 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
|
||||
@@ -129,7 +129,7 @@ export const footnotesLabel = (node: Element) => {
|
||||
];
|
||||
};
|
||||
|
||||
export const imagesStyle = (node: Element, parent: Root | Element | null) => {
|
||||
export const imagesStyle = (node: Element, parent: Root | Element | undefined) => {
|
||||
if (
|
||||
parent?.type === 'element' &&
|
||||
/(p|a)/.test(parent.tagName) &&
|
||||
|
||||
@@ -26,19 +26,21 @@ export function markdownToHTML(md: string, css: string, opts: MarkdownToHTMLOpti
|
||||
parseCustomProperty: false,
|
||||
positions: false,
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const data = cssdata(ast.children.head, {}, { color: opts.preColor, theme: opts.previewTheme });
|
||||
const processor = unified()
|
||||
.use(remarkParse)
|
||||
.use(remarkGfm)
|
||||
.use(remarkRehype, { allowDangerousHtml: true })
|
||||
.use(rehypePrism)
|
||||
.use(rehypeRaw)
|
||||
.use(rehypePrism, {
|
||||
ignoreMissing: true,
|
||||
})
|
||||
.use(rehypeIgnore, {})
|
||||
.use(rehypeAttrs, { properties: 'attr' })
|
||||
.use(rehypeRewrite, {
|
||||
rewrite: (node, _index, parent) => {
|
||||
// @ts-ignore
|
||||
if (
|
||||
node?.type === 'element' &&
|
||||
node?.tagName === 'code' &&
|
||||
|
||||
Reference in New Issue
Block a user