Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.0 #1792

Merged
merged 6 commits into from
Oct 5, 2023
Merged

0.8.0 #1792

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.0] - 2023-10-05

Updated [crossnote](https://github.com/shd101wyy/crossnote) to version [0.8.17](https://github.com/shd101wyy/crossnote/releases/tag/0.8.17) then version [0.8.18](https://github.com/shd101wyy/crossnote/releases/tag/0.8.18).

### New features

- 📝 Supported in-preview editor that allows you to edit the markdown file directly in the preview 🎉.
This feature is currently in beta.
When the editor is open, you can press `ctrl+s` or `cmd+s` to save the markdown file. You can also press `esc` to close the editor.
- Deprecated the VS Code setting `markdown-preview-enhanced.singlePreview`.
Now replaced by `markdown-preview-enhanced.previewMode`:

- **Single Preview** (_default_)
Only one preview will be shown for all editors.
- **Multiple Previews**
Multiple previews will be shown. Each editor has its own preview.
- **Previews Only** 🆕
No editor will be shown. Only previews will be shown. You can use the in-preview editor to edit the markdown.

🔔 Please note that enable this option will automatically modify the `workbench.editorAssociations` setting to make sure the markdown files are opened in the custom editor for preview.

- Added two new VS Code commands `Markdown Preview Enhanced: Customize Preview Html Head (Workspace)` and `Markdown Preview Enhanced: Customize Preview Html Head (Global)`, which will open the `head.html` file for you to customize the `<head>` of the preview.

- Supported to set attribute to image and link, e.g.:

```markdown
![](path/to/image.png){width=100 height=100}
```

- Improved the markdown transformer to better insert anchors for scroll sync and highlight lines and elements.
Added more tests for the markdown transformer to make sure it works as expected.
- Added the reading time estimation in the preview footer ⏲️.
- Added `Edit Markdown` menu item to the context menu of the preview, which offers two options:
- **Open VS Code Editor**
Open the markdown file in VS Code editor.
- **Open In-preview Editor**
Open the markdown file in the in-preview editor.
- Updated the mermaid version to the latest `10.5.0`
- Updated the `katex` version to `0.16.9`.
- Added the API website: https://shd101wyy.github.io/crossnote/

### Bug fixes

- Fixed the font size of the `github-dark.css` code block theme.
- Fixed the anchor jump bugs: https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/1790
- Fixed list item style bug: https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/1789
- Fixed a data race bug that caused the preview to hang.

## [0.7.10] - 2023-09-24

Updated [crossnote](https://github.com/shd101wyy/crossnote) to version [0.8.16](https://github.com/shd101wyy/crossnote/releases/tag/0.8.16)
Expand Down
9 changes: 8 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { execSync } = require('child_process');
const { context, build } = require('esbuild');
const { polyfillNode } = require('esbuild-plugin-polyfill-node');

Expand All @@ -10,6 +11,10 @@
setup(build) {
build.onStart(() => {
console.log('[watch] build started');

// Run `gulp copy:files` before build
execSync('gulp copy-files');
console.log('[watch] gulp copy-files');
});
build.onEnd((result) => {
if (result.errors.length) {
Expand All @@ -18,7 +23,9 @@
`> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}`,
),
);
} else console.log('[watch] build finished');
} else {
console.log('[watch] build finished');
}
});
},
};
Expand Down Expand Up @@ -85,7 +92,7 @@
// window: "globalThis",
'window': JSON.stringify(defaultWindow),
// document: JSON.stringify(defaultDocument),
'process.env.IS_VSCODE_WEB_EXTENSION': '"true"',

Check warning on line 95 in build.js

View workflow job for this annotation

GitHub Actions / Test

Object Literal Property name `process.env.IS_VSCODE_WEB_EXTENSION` must match one of the following formats: camelCase
},
};

Expand All @@ -109,7 +116,7 @@
define: {
...(webConfig.define ?? {}),
...{
'process.env.IS_VSCODE_WEB_EXTENSION_DEV_MODE': '"true"',

Check warning on line 119 in build.js

View workflow job for this annotation

GitHub Actions / Test

Object Literal Property name `process.env.IS_VSCODE_WEB_EXTENSION_DEV_MODE` must match one of the following formats: camelCase
},
},
plugins: [esbuildProblemMatcherPlugin, ...(webConfig.plugins ?? [])],
Expand Down
54 changes: 40 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "markdown-preview-enhanced",
"displayName": "%displayName%",
"version": "0.7.10",
"version": "0.8.0",
"description": "%description%",
"categories": [
"Other"
Expand All @@ -23,11 +23,10 @@
"main": "./out/native/extension.js",
"browser": "./out/web/extension.js",
"scripts": {
"build": "yarn copy:files && gulp clean-out && node build.js",
"build": "gulp copy-files && gulp clean-out && node build.js",
"check:all": "yarn check:eslint && yarn check:prettier",
"check:eslint": "eslint \"**/*\"",
"check:prettier": "prettier --check \"**/*.*\"",
"copy:files": "gulp copy-files",
"fix:all": "yarn fix:eslint && yarn fix:eslint && yarn fix:prettier",
"fix:eslint": "eslint --fix \"**/*\"",
"fix:prettier": "prettier --write \"**/*.*\"",
Expand All @@ -36,7 +35,7 @@
"run-in-vscode-dev": "npx serve --cors -l 5000 --ssl-cert $HOME/certs/localhost.pem --ssl-key $HOME/certs/localhost-key.pem",
"test": "yarn build && node ./node_modules/vscode/bin/test",
"vscode:prepublish": "yarn install && yarn build",
"watch": "yarn copy:files && gulp clean-out && node build.js --watch"
"watch": "gulp copy-files && gulp clean-out && node build.js --watch"
},
"contributes": {
"commands": [
Expand Down Expand Up @@ -122,6 +121,11 @@
"title": "%markdown-preview-enhanced.extendParser.title%",
"enablement": "!isWeb"
},
{
"command": "markdown-preview-enhanced.customizePreviewHtmlHead",
"title": "%markdown-preview-enhanced.customizePreviewHtmlHead.title%",
"enablement": "!isWeb"
},
{
"command": "markdown-preview-enhanced.openConfigScriptInWorkspace",
"title": "%markdown-preview-enhanced.openConfigScriptInWorkspace.title%"
Expand All @@ -130,6 +134,10 @@
"command": "markdown-preview-enhanced.extendParserInWorkspace",
"title": "%markdown-preview-enhanced.extendParserInWorkspace.title%"
},
{
"command": "markdown-preview-enhanced.customizePreviewHtmlHeadInWorkspace",
"title": "%markdown-preview-enhanced.customizePreviewHtmlHeadInWorkspace.title%"
},
{
"command": "markdown-preview-enhanced.showUploadedImages",
"title": "%markdown-preview-enhanced.showUploadedImages.title%",
Expand All @@ -141,7 +149,7 @@
"title": "Markdown Preview Enhanced",
"properties": {
"markdown-preview-enhanced.configPath": {
"markdownDescription": "Restart is required after changes. The configuration directory path. Leave it empty to use `$HOME/.crossnote` for Windows or `$XDG_CONFIG_HOME/.crossnote` or `$HOME/.local/state/crossnote` as the config path.",
"markdownDescription": "Restart is required after changes. The global configuration directory path. Leave it empty to use `$HOME/.crossnote` for Windows or `$XDG_CONFIG_HOME/.crossnote` or `$HOME/.local/state/crossnote` as the config path.",
"default": "",
"type": "string"
},
Expand All @@ -165,10 +173,15 @@
"default": true,
"type": "boolean"
},
"markdown-preview-enhanced.singlePreview": {
"description": "Open Only One Preview.",
"default": true,
"type": "boolean"
"markdown-preview-enhanced.previewMode": {
"markdownDescription": "- **Single Preview**: Only one preview will be shown for all editors.\n- **Multiple Previews**: Multiple previews will be shown. Each editor has its own preview.\n- **Previews Only**: No editor will be shown. Only previews will be shown. You can use the in-preview editor to edit the markdown.\n\nRestart is required after changes.",
"type": "string",
"enum": [
"Single Preview",
"Multiple Previews",
"Previews Only"
],
"default": "Single Preview"
},
"markdown-preview-enhanced.automaticallyShowPreviewOfMarkdownBeingEdited": {
"description": "Automatically show preview of markdown being edited.",
Expand Down Expand Up @@ -408,22 +421,22 @@
"qiniu"
]
},
"markdown-preview-enhanced.AccessKey": {
"markdown-preview-enhanced.qiniuAccessKey": {
"type": "string",
"default": "",
"description": "Qiniu AccessKey"
},
"markdown-preview-enhanced.SecretKey": {
"markdown-preview-enhanced.qiniuSecretKey": {
"type": "string",
"default": "",
"description": "Qiniu SecretKey"
},
"markdown-preview-enhanced.Bucket": {
"markdown-preview-enhanced.qiniuBucket": {
"type": "string",
"default": "",
"description": "Qiniu Bucket"
},
"markdown-preview-enhanced.Domain": {
"markdown-preview-enhanced.qiniuDomain": {
"type": "string",
"default": "http://",
"description": "Qiniu Domain"
Expand Down Expand Up @@ -556,6 +569,18 @@
}
}
},
"customEditors": [
{
"viewType": "markdown-preview-enhanced",
"displayName": "%customEditorPreviewDisplayName%",
"selector": [
{
"filenamePattern": "*.{md,markdown,mdown,mkdn,mkd,rmd,qmd}"
}
],
"priority": "option"
}
],
"keybindings": [
{
"command": "markdown-preview-enhanced.openPreviewToTheSide",
Expand Down Expand Up @@ -620,7 +645,8 @@
"dependencies": {
"@types/crypto-js": "^4.1.2",
"@types/vfile": "^3.0.2",
"crossnote": "^0.8.16",
"async-mutex": "^0.4.0",
"crossnote": "^0.8.18",
"crypto-js": "^4.1.1"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"displayName": "Markdown Preview Enhanced",
"description": "Markdown Preview Enhanced ported to vscode",
"customEditorPreviewDisplayName": "Markdown Preview Enhanced",
"markdown-preview-enhanced.openPreviewToTheSide.title": "Markdown Preview Enhanced: Open Preview to the Side",
"markdown-preview-enhanced.openPreview.title": "Markdown Preview Enhanced: Open Preview",
"markdown-preview-enhanced.toggleScrollSync.title": "Markdown Preview Enhanced: Toggle Scroll Sync",
Expand All @@ -20,5 +21,7 @@
"markdown-preview-enhanced.openConfigScriptInWorkspace.title": "Markdown Preview Enhanced: Open Config Script (Workspace)",
"markdown-preview-enhanced.extendParser.title": "Markdown Preview Enhanced: Extend Parser (Global)",
"markdown-preview-enhanced.extendParserInWorkspace.title": "Markdown Preview Enhanced: Extend Parser (Workspace)",
"markdown-preview-enhanced.customizePreviewHtmlHead.title": "Markdown Preview Enhanced: Customize Preview Html Head (Global)",
"markdown-preview-enhanced.customizePreviewHtmlHeadInWorkspace.title": "Markdown Preview Enhanced: Customize Preview Html Head (Workspace)",
"markdown-preview-enhanced.showUploadedImages.title": "Markdown Preview Enhanced: Show Uploaded Images"
}
3 changes: 3 additions & 0 deletions package.nls.zh.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"displayName": "Markdown 增强预览",
"description": " 这款插件意在让你拥有飘逸的 Markdown 写作体验",
"customEditorPreviewDisplayName": "Markdown 增强预览",
"markdown-preview-enhanced.openPreviewToTheSide.title": "MPE:打开侧边预览",
"markdown-preview-enhanced.openPreview.title": "MPE:打开预览",
"markdown-preview-enhanced.toggleScrollSync.title": "MPE:开关预览滑动同步",
Expand All @@ -20,5 +21,7 @@
"markdown-preview-enhanced.openConfigScriptInWorkspace.title": "MPE:打开配置脚本(工作区)",
"markdown-preview-enhanced.extendParser.title": "MPE:扩展 Parser(全局)",
"markdown-preview-enhanced.extendParserInWorkspace.title": "MPE:扩展 Parser(工作区)",
"markdown-preview-enhanced.customizePreviewHtmlHead.title": "MPE:自定义预览 HTML 头部(全局)",
"markdown-preview-enhanced.customizePreviewHtmlHeadInWorkspace.title": "MPE:自定义预览 HTML 头部(工作区)",
"markdown-preview-enhanced.showUploadedImages.title": "MPE:显示图片上传历史"
}
3 changes: 2 additions & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**@type {import("prettier").Config} */
module.exports = {
semi: true,
arrowParens: 'always',
endOfLine: 'lf',
quoteProps: 'consistent',
trailingComma: 'all',
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
};
Loading
Loading