diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index e8c16d89c4..0000000000
--- a/.babelrc
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "comments": false,
- "env": {
- "test": {
- "presets": [
- ["env", {
- "targets": { "node": 8 }
- }],
- "stage-0"
- ],
- "plugins": ["istanbul"]
- },
- "main": {
- "presets": [
- ["env", {
- "targets": { "node": 8 }
- }],
- "stage-0"
- ]
- },
- "renderer": {
- "presets": [
- ["env", {
- "modules": false,
- "useBuiltIns": true,
- "targets": {
- "browsers": [
- "Chrome >= 66"
- ]
- }
- }],
- "stage-0"
- ]
- },
- "web": {
- "presets": [
- ["env", {
- "modules": false
- }],
- "stage-0"
- ]
- }
- },
- "plugins": [["component", {
- "style": false,
- "libraryName": "element-ui"
- }
- ], "transform-runtime"]
-}
diff --git a/.editorconfig b/.editorconfig
index 9f89e70533..3dce4145ff 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,10 +1,9 @@
root = true
-# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
-trim_trailing_whitespace = true
-end_of_line = lf
-insert_final_newline = true
indent_style = space
indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
\ No newline at end of file
diff --git a/.electron-vue/build.js b/.electron-vue/build.js
deleted file mode 100644
index 7cb7f26cc1..0000000000
--- a/.electron-vue/build.js
+++ /dev/null
@@ -1,121 +0,0 @@
-'use strict'
-
-process.env.NODE_ENV = 'production'
-
-const { say } = require('cfonts')
-const path = require('path')
-const chalk = require('chalk')
-const del = require('del')
-const fs = require('fs-extra')
-const webpack = require('webpack')
-const Multispinner = require('multispinner')
-
-
-const mainConfig = require('./webpack.main.config')
-const rendererConfig = require('./webpack.renderer.config')
-
-const doneLog = chalk.bgGreen.white(' DONE ') + ' '
-const errorLog = chalk.bgRed.white(' ERROR ') + ' '
-const okayLog = chalk.bgBlue.white(' OKAY ') + ' '
-const isCI = process.env.CI || false
-
-if (process.env.BUILD_TARGET === 'clean') clean()
-else if (process.env.BUILD_TARGET === 'web') web()
-else build()
-
-function clean () {
- del.sync(['build/*', '!build/icons', '!build/icons/icon.*'])
- console.log(`\n${doneLog}\n`)
- process.exit()
-}
-
-async function build () {
- greeting()
-
- del.sync(['dist/electron/*', '!.gitkeep'])
- del.sync(['static/themes/*'])
-
- const from = path.resolve(__dirname, '../src/muya/themes')
- const to = path.resolve(__dirname, '../static/themes')
- await fs.copy(from, to)
-
- const tasks = ['main', 'renderer']
- const m = new Multispinner(tasks, {
- preText: 'building',
- postText: 'process'
- })
-
- let results = ''
-
- m.on('success', () => {
- process.stdout.write('\x1B[2J\x1B[0f')
- console.log(`\n\n${results}`)
- console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
- process.exit()
- })
-
- pack(mainConfig).then(result => {
- results += result + '\n\n'
- m.success('main')
- }).catch(err => {
- m.error('main')
- console.log(`\n ${errorLog}failed to build main process`)
- console.error(`\n${err}\n`)
- process.exit(1)
- })
-
- pack(rendererConfig).then(result => {
- results += result + '\n\n'
- m.success('renderer')
- }).catch(err => {
- m.error('renderer')
- console.log(`\n ${errorLog}failed to build renderer process`)
- console.error(`\n${err}\n`)
- process.exit(1)
- })
-}
-
-function pack (config) {
- return new Promise((resolve, reject) => {
- webpack(config, (err, stats) => {
- if (err) reject(err.stack || err)
- else if (stats.hasErrors()) {
- let err = ''
-
- stats.toString({
- chunks: false,
- colors: true
- })
- .split(/\r?\n/)
- .forEach(line => {
- err += ` ${line}\n`
- })
-
- reject(err)
- } else {
- resolve(stats.toString({
- chunks: false,
- colors: true
- }))
- }
- })
- })
-}
-
-function greeting () {
- const cols = process.stdout.columns
- let text = ''
-
- if (cols > 85) text = 'lets-build'
- else if (cols > 60) text = 'lets-|build'
- else text = false
-
- if (text && !isCI) {
- say(text, {
- colors: ['yellow'],
- font: 'simple3d',
- space: false
- })
- } else console.log(chalk.yellow.bold('\n lets-build'))
- console.log()
-}
diff --git a/.electron-vue/dev-client.js b/.electron-vue/dev-client.js
deleted file mode 100644
index 2913ea4b07..0000000000
--- a/.electron-vue/dev-client.js
+++ /dev/null
@@ -1,40 +0,0 @@
-const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
-
-hotClient.subscribe(event => {
- /**
- * Reload browser when HTMLWebpackPlugin emits a new index.html
- *
- * Currently disabled until jantimon/html-webpack-plugin#680 is resolved.
- * https://github.com/SimulatedGREG/electron-vue/issues/437
- * https://github.com/jantimon/html-webpack-plugin/issues/680
- */
- // if (event.action === 'reload') {
- // window.location.reload()
- // }
-
- /**
- * Notify `mainWindow` when `main` process is compiling,
- * giving notice for an expected reload of the `electron` process
- */
- if (event.action === 'compiling') {
- document.body.innerHTML += `
-
-
-
- Compiling Main Process...
-
- `
- }
-})
diff --git a/.electron-vue/dev-runner.js b/.electron-vue/dev-runner.js
deleted file mode 100644
index 63684c14d6..0000000000
--- a/.electron-vue/dev-runner.js
+++ /dev/null
@@ -1,183 +0,0 @@
-'use strict'
-
-const chalk = require('chalk')
-const electron = require('electron')
-const path = require('path')
-const { say } = require('cfonts')
-const { spawn } = require('child_process')
-const webpack = require('webpack')
-const WebpackDevServer = require('webpack-dev-server')
-const webpackHotMiddleware = require('webpack-hot-middleware')
-
-const mainConfig = require('./webpack.main.config')
-const rendererConfig = require('./webpack.renderer.config')
-
-let electronProcess = null
-let manualRestart = false
-let hotMiddleware
-
-function logStats (proc, data) {
- let log = ''
-
- log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`)
- log += '\n\n'
-
- if (typeof data === 'object') {
- data.toString({
- colors: true,
- chunks: false
- }).split(/\r?\n/).forEach(line => {
- log += ' ' + line + '\n'
- })
- } else {
- log += ` ${data}\n`
- }
-
- log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n'
-
- console.log(log)
-}
-
-function startRenderer () {
- return new Promise((resolve, reject) => {
- rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer)
-
- const compiler = webpack(rendererConfig)
- hotMiddleware = webpackHotMiddleware(compiler, {
- log: false,
- heartbeat: 2500
- })
-
- compiler.plugin('compilation', compilation => {
- compilation.plugin('html-webpack-plugin-after-emit', (data, cb) => {
- hotMiddleware.publish({ action: 'reload' })
- cb && cb()
- })
- })
-
- compiler.plugin('done', stats => {
- logStats('Renderer', stats)
- })
-
- const server = new WebpackDevServer(
- compiler,
- {
- contentBase: path.join(__dirname, '../'),
- quiet: true,
- setup (app, ctx) {
- app.use(hotMiddleware)
- ctx.middleware.waitUntilValid(() => {
- resolve()
- })
- }
- }
- )
-
- server.listen(9091)
- })
-}
-
-function startMain () {
- return new Promise((resolve, reject) => {
- mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main)
-
- const compiler = webpack(mainConfig)
-
- compiler.plugin('watch-run', (compilation, done) => {
- logStats('Main', chalk.white.bold('compiling...'))
- hotMiddleware.publish({ action: 'compiling' })
- done()
- })
-
- compiler.watch({}, (err, stats) => {
- if (err) {
- console.log(err)
- return
- }
-
- logStats('Main', stats)
-
- if (electronProcess && electronProcess.kill) {
- manualRestart = true
- process.kill(electronProcess.pid)
- electronProcess = null
- startElectron()
-
- setTimeout(() => {
- manualRestart = false
- }, 5000)
- }
-
- resolve()
- })
- })
-}
-
-function startElectron () {
- electronProcess = spawn(electron, [
- '--inspect=5861',
- '--remote-debugging-port=8315',
- '--nolazy',
- path.join(__dirname, '../dist/electron/main.js')
- ])
-
- electronProcess.stdout.on('data', data => {
- electronLog(data, 'blue')
- })
- electronProcess.stderr.on('data', data => {
- electronLog(data, 'red')
- })
-
- electronProcess.on('close', () => {
- if (!manualRestart) process.exit()
- })
-}
-
-function electronLog (data, color) {
- let log = ''
- data = data.toString().split(/\r?\n/)
- data.forEach(line => {
- log += ` ${line}\n`
- })
- if (/[0-9A-z]+/.test(log)) {
- console.log(
- chalk[color].bold('┏ Electron -------------------') +
- '\n\n' +
- log +
- chalk[color].bold('┗ ----------------------------') +
- '\n'
- )
- }
-}
-
-function greeting () {
- const cols = process.stdout.columns
- let text = ''
-
- if (cols > 104) text = 'electron-vue'
- else if (cols > 76) text = 'electron-|vue'
- else text = false
-
- if (text) {
- say(text, {
- colors: ['yellow'],
- font: 'simple3d',
- space: false
- })
- } else console.log(chalk.yellow.bold('\n electron-vue'))
- console.log(chalk.blue(' getting ready...') + '\n')
-}
-
-function init () {
- greeting()
-
- Promise.all([startRenderer(), startMain()])
- .then(() => {
- startElectron()
- })
- .catch(err => {
- console.error(err)
- })
-}
-
-init()
diff --git a/.electron-vue/marktextEnvironment.js b/.electron-vue/marktextEnvironment.js
deleted file mode 100644
index a7f21975ba..0000000000
--- a/.electron-vue/marktextEnvironment.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const GitRevisionPlugin = require('git-revision-webpack-plugin')
-const { version } = require('../package.json')
-
-const getEnvironmentDefinitions = function () {
- let shortHash = 'N/A'
- let fullHash = 'N/A'
- try {
- const gitRevisionPlugin = new GitRevisionPlugin()
- shortHash = gitRevisionPlugin.version()
- fullHash = gitRevisionPlugin.commithash()
- } catch(_) {
- // Ignore error if we build without git.
- }
- const isOfficialRelease = !!process.env.MARKTEXT_IS_OFFICIAL_RELEASE
- const versionSuffix = isOfficialRelease ? '' : ` (${shortHash})`
-
- return {
- 'global.MARKTEXT_GIT_SHORT_HASH': JSON.stringify(shortHash),
- 'global.MARKTEXT_GIT_HASH': JSON.stringify(fullHash),
-
- 'global.MARKTEXT_VERSION': JSON.stringify(version),
- 'global.MARKTEXT_VERSION_STRING': JSON.stringify(`v${version}${versionSuffix}`),
- 'global.MARKTEXT_IS_OFFICIAL_RELEASE': JSON.stringify(isOfficialRelease)
- }
-}
-
-const getRendererEnvironmentDefinitions = function () {
- const env = getEnvironmentDefinitions()
- return {
- 'process.versions.MARKTEXT_VERSION': env['global.MARKTEXT_VERSION'],
- 'process.versions.MARKTEXT_VERSION_STRING': env['global.MARKTEXT_VERSION_STRING'],
- }
-}
-
-module.exports = {
- getEnvironmentDefinitions: getEnvironmentDefinitions,
- getRendererEnvironmentDefinitions: getRendererEnvironmentDefinitions
-}
diff --git a/.electron-vue/preinstall.js b/.electron-vue/preinstall.js
deleted file mode 100644
index faf45141b4..0000000000
--- a/.electron-vue/preinstall.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict'
-
-if (!/yarn\.js$/.test(process.env.npm_execpath)) {
- console.error('Please use yarn to install dependencies.\n')
- process.exit(1)
-}
diff --git a/.electron-vue/thirdPartyChecker.js b/.electron-vue/thirdPartyChecker.js
deleted file mode 100644
index 6374640389..0000000000
--- a/.electron-vue/thirdPartyChecker.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict'
-
-const checker = require('license-checker')
-
-const getLicenses = (rootDir, callback) => {
- checker.init({
- start: rootDir,
- production: true,
- development: false,
- direct: true,
- json: true,
- onlyAllow: 'Unlicense;WTFPL;ISC;MIT;BSD;ISC;Apache-2.0;MIT*;Apache*;BSD*',
- customPath: {
- "licenses": "",
- "licenseText": "none"
- }
- }, function(err, packages) {
- callback(err, packages, checker)
- })
-}
-
-// Check that all production dependencies are allowed.
-const validateLicenses = rootDir => {
- getLicenses(rootDir, (err, packages, checker) => {
- if (err) {
- console.log(`[ERROR] ${err}`)
- process.exit(1)
- }
- console.log(checker.asSummary(packages))
- })
-}
-
-module.exports = {
- getLicenses: getLicenses,
- validateLicenses: validateLicenses
-}
diff --git a/.electron-vue/webpack.main.config.js b/.electron-vue/webpack.main.config.js
deleted file mode 100644
index f1e2f1c1d0..0000000000
--- a/.electron-vue/webpack.main.config.js
+++ /dev/null
@@ -1,92 +0,0 @@
-'use strict'
-
-process.env.BABEL_ENV = 'main'
-
-const path = require('path')
-const { getEnvironmentDefinitions } = require('./marktextEnvironment')
-const { dependencies } = require('../package.json')
-const webpack = require('webpack')
-const proMode = process.env.NODE_ENV === 'production'
-
-const mainConfig = {
- mode: 'development',
- devtool: '#cheap-module-eval-source-map',
- entry: {
- main: path.join(__dirname, '../src/main/index.js')
- },
- externals: [
- ...Object.keys(dependencies || {})
- ],
- module: {
- rules: [
- {
- test: /\.(js)$/,
- enforce: 'pre',
- exclude: /node_modules/,
- use: {
- loader: 'eslint-loader',
- options: {
- formatter: require('eslint-friendly-formatter'),
- failOnError: true
- }
- }
- },
- {
- test: /\.js$/,
- use: 'babel-loader',
- exclude: /node_modules/
- },
- {
- test: /\.node$/,
- use: 'node-loader'
- }
- ]
- },
- node: {
- __dirname: !proMode,
- __filename: !proMode
- },
- output: {
- filename: '[name].js',
- libraryTarget: 'commonjs2',
- path: path.join(__dirname, '../dist/electron')
- },
- plugins: [
- new webpack.NoEmitOnErrorsPlugin(),
- // Add global environment definitions.
- new webpack.DefinePlugin(getEnvironmentDefinitions())
- ],
- resolve: {
- alias: {
- 'common': path.join(__dirname, '../src/common')
- },
- extensions: ['.js', '.json', '.node']
- },
- target: 'electron-main'
-}
-
-// Fix debugger breakpoints
-if (!proMode && process.env.MARKTEXT_BUILD_VSCODE_DEBUG) {
- mainConfig.devtool = '#inline-source-map'
-}
-
-/**
- * Adjust mainConfig for development settings
- */
-if (!proMode) {
- mainConfig.plugins.push(
- new webpack.DefinePlugin({
- '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
- })
- )
-}
-
-/**
- * Adjust mainConfig for production settings
- */
-if (proMode) {
- mainConfig.devtool = '#nosources-source-map'
- mainConfig.mode = 'production'
-}
-
-module.exports = mainConfig
diff --git a/.electron-vue/webpack.renderer.config.js b/.electron-vue/webpack.renderer.config.js
deleted file mode 100644
index d4613346d9..0000000000
--- a/.electron-vue/webpack.renderer.config.js
+++ /dev/null
@@ -1,236 +0,0 @@
-'use strict'
-
-process.env.BABEL_ENV = 'renderer'
-
-const path = require('path')
-const webpack = require('webpack')
-const CopyWebpackPlugin = require('copy-webpack-plugin')
-const MiniCssExtractPlugin = require("mini-css-extract-plugin")
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const VueLoaderPlugin = require('vue-loader/lib/plugin')
-const SpritePlugin = require('svg-sprite-loader/plugin')
-const postcssPresetEnv = require('postcss-preset-env')
-const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
-
-const { getRendererEnvironmentDefinitions } = require('./marktextEnvironment')
-const { dependencies } = require('../package.json')
-const proMode = process.env.NODE_ENV === 'production'
-/**
- * List of node_modules to include in webpack bundle
- * Required for specific packages like Vue UI libraries
- * that provide pure *.vue files that need compiling
- * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
- */
-const whiteListedModules = ['vue']
-
-const rendererConfig = {
- mode: 'development',
- devtool: '#cheap-module-eval-source-map',
- entry: {
- renderer: path.join(__dirname, '../src/renderer/main.js')
- },
- externals: [
- ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d))
- ],
- module: {
- rules: [
- {
- test: /\.(js|vue)$/,
- enforce: 'pre',
- exclude: /node_modules/,
- use: {
- loader: 'eslint-loader',
- options: {
- formatter: require('eslint-friendly-formatter'),
- failOnError: true
- }
- }
- },
- {
- test: /(theme\-chalk(?:\/|\\)index|katex|github\-markdown|prism[\-a-z]*|\.theme)\.css$/,
- use: [
- 'to-string-loader',
- 'css-loader'
- ]
- },
- {
- test: /\.css$/,
- exclude: /(theme\-chalk(?:\/|\\)index|katex|github\-markdown|prism[\-a-z]*|\.theme)\.css$/,
- use: [
- proMode ? MiniCssExtractPlugin.loader : 'style-loader',
- { loader: 'css-loader', options: { importLoaders: 1 } },
- { loader: 'postcss-loader', options: {
- ident: 'postcss',
- plugins: () => [
- postcssPresetEnv({
- stage: 0
- })
- ]
- } }
- ]
- },
- {
- test: /\.html$/,
- use: 'vue-html-loader'
- },
- {
- test: /\.js$/,
- use: 'babel-loader',
- exclude: /node_modules/
- },
- {
- test: /\.node$/,
- use: 'node-loader'
- },
- {
- test: /\.vue$/,
- use: {
- loader: 'vue-loader',
- options: {
- sourceMap: true
- }
- }
- },
- {
- test: /\.svg$/,
- use: [
- {
- loader: 'svg-sprite-loader',
- options: {
- extract: true,
- publicPath: './static/'
- }
- },
- 'svgo-loader'
- ]
- },
- {
- test: /\.(png|jpe?g|gif)(\?.*)?$/,
- use: {
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: 'imgs/[name]--[folder].[ext]'
- }
- }
- },
- {
- test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: 'media/[name]--[folder].[ext]'
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- use: {
- loader: 'url-loader',
- query: {
- limit: 100000,
- name: 'fonts/[name]--[folder].[ext]'
- }
- }
- },
- {
- test: /\.md$/,
- use: [
- 'raw-loader'
- ]
- }
- ]
- },
- node: {
- __dirname: !proMode,
- __filename: !proMode
- },
- plugins: [
- new SpritePlugin(),
- new HtmlWebpackPlugin({
- filename: 'index.html',
- template: path.resolve(__dirname, '../src/index.ejs'),
- minify: {
- collapseWhitespace: true,
- removeAttributeQuotes: true,
- removeComments: true
- },
- nodeModules: process.env.NODE_ENV !== 'production'
- ? path.resolve(__dirname, '../node_modules')
- : false
- }),
- new webpack.NoEmitOnErrorsPlugin(),
- new webpack.DefinePlugin(getRendererEnvironmentDefinitions()),
- new VueLoaderPlugin()
- ],
- output: {
- filename: '[name].js',
- libraryTarget: 'commonjs2',
- path: path.join(__dirname, '../dist/electron')
- },
- resolve: {
- alias: {
- '@': path.join(__dirname, '../src/renderer'),
- 'common': path.join(__dirname, '../src/common'),
- 'muya': path.join(__dirname, '../src/muya'),
- 'vue$': 'vue/dist/vue.esm.js'
- },
- extensions: ['.js', '.vue', '.json', '.css', '.node']
- },
- target: 'electron-renderer'
-}
-
-/**
- * Adjust rendererConfig for development settings
- */
-if (!proMode) {
- rendererConfig.plugins.push(
- new webpack.DefinePlugin({
- '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
- }),
- new webpack.HotModuleReplacementPlugin()
- )
-}
-
-if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' &&
- !process.env.MARKTEXT_DEV_HIDE_BROWSER_ANALYZER) {
- rendererConfig.plugins.push(
- new BundleAnalyzerPlugin()
- )
-}
-
-// Fix debugger breakpoints
-if (!proMode && process.env.MARKTEXT_BUILD_VSCODE_DEBUG) {
- rendererConfig.devtool = '#inline-source-map'
-}
-
-/**
- * Adjust rendererConfig for production settings
- */
-if (proMode) {
- rendererConfig.devtool = '#nosources-source-map'
- rendererConfig.mode = 'production'
- rendererConfig.plugins.push(
- new MiniCssExtractPlugin({
- // Options similar to the same options in webpackOptions.output
- // both options are optional
- filename: '[name].[hash].css',
- chunkFilename: '[id].[hash].css'
- }),
- new CopyWebpackPlugin([
- {
- from: path.join(__dirname, '../static'),
- to: path.join(__dirname, '../dist/electron/static'),
- ignore: ['.*']
- },
- {
- from: path.resolve(__dirname, '../node_modules/codemirror/mode/*/*'),
- to: path.join(__dirname, '../dist/electron/codemirror/mode/[name]/[name].js')
- }
- ]),
- new webpack.LoaderOptionsPlugin({
- minimize: true
- })
- )
-}
-
-module.exports = rendererConfig
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 4deafc0f9c..0000000000
--- a/.eslintignore
+++ /dev/null
@@ -1,5 +0,0 @@
-test/unit/coverage/**
-test/unit/*.js
-test/e2e/*.js
-src/renderer/assets/symbolIcon/index.js
-src/muya/lib/assets/libs/*.js
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 311806381d..0000000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,55 +0,0 @@
-module.exports = {
- root: true,
- parserOptions: {
- parser: 'babel-eslint',
- ecmaVersion: 8,
- ecmaFeatures: {
- impliedStrict: true
- },
- sourceType: 'module'
- },
- env: {
- browser: true,
- es6: true,
- node: true
- },
- extends: [
- 'standard',
- 'eslint:recommended',
- 'plugin:vue/base',
- 'plugin:import/errors',
- 'plugin:import/warnings'
- ],
- globals: {
- __static: true
- },
- plugins: [
- 'html',
- 'vue'
- ],
- rules: {
- // allow paren-less arrow functions
- 'arrow-parens': 0,
- // allow async-await
- 'generator-star-spacing': 0,
- // allow console
- 'no-console': 0,
- // allow debugger during development
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
- // disallow semicolons
- semi: [2, "never"]
- },
- settings: {
- 'import/resolver': {
- alias: {
- map: [
- ['common', './src/common'],
- // Normally only valid for renderer/
- ['@', './src/renderer'],
- ['muya', './src/muya']
- ],
- extensions: ['.js', '.vue', '.json', '.css', '.node']
- }
- }
- }
-}
diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md
deleted file mode 100644
index 434e1457de..0000000000
--- a/.github/CHANGELOG.md
+++ /dev/null
@@ -1,552 +0,0 @@
-## [unrelease]
-
-**:warning:Breaking Changes:**
-
-- `preference.md` is deprecated and no longer supported. Please use the GUI or edit `preferences.json` manually.
-
-**:cactus:Feature**
-
-- The cursor jump to the end of format or to the next brackets when press `tab`(#976)
-- Tab drag & drop inside the window
-- Scrollable tabs
-
-**:butterfly:Optimization**
-
-- Rewrite `select all` when press `CtrlOrCmd + A` (#937)
-- Set the cursor at the end of `#` in header when press arrow down to jump to the next paragraph.(#978)
-- Improved startup time
-
-**:beetle:Bug fix**
-
-- Fixed some commonmark failed examples and add test case (#943)
-- Fixed some bugs after press `backspace` (#934, #938)
-- Change `inline math` vertical align to `top` (#977)
-- Prevent to open the same file twice, instead select the existing tab (#878)
-
-### 0.14.0
-
-This update **fixes a XSS security vulnerability** when exporting a document.
-
-**:warning:Breaking Changes:**
-
-- Minimum supported macOS version is 10.10 (Yosemite)
-- Remove `lightColor` and `darkColor` in user preference (color change in view menu does not work any, and will remove when add custom theme.)
-- We recommend user not use block element in paragraph, please use block element in html block.
-
-*Not Recommended*
-
-```md
-foozar
-```
-
-*Recommended*
-
-```md
-
- foo
-
- zar
-
-```
-
-**:cactus:Feature**
-
-- Improve exception and error handling
-- Support for user-defined titlebar style
-- Support to open files in a new tab instead a new window (#574)
-- Add inline math to format menu and float box (#649)
-- GTK integration (#690)
-- Add recently used directories to recently opened files (#643)
-- Making images display smaller (#659)
-- Open local markdown file when you click on it in another tab (#359)
-- Clicking a link should open it in the browser (#425)
-- Support maxOS `dark mode`, when you change `mode dark or light` in system, Mark Text will change its theme.
-- Add new themes: Ulysses Light, Graphite Light, Material Dark and One Dark.
-- Watch file changed in tabs and show a notice(autoSave is `false`) or update the file(autoSave is `true`)
-- Support input inline Ruby charactors as raw html (#257)
-- Added unsaved tab indicator
-- Add front Menu by click the front menu icon (#875)
-- Support diagram: [flowchart](https://github.com/adrai/flowchart.js), [vega-lite](https://github.com/vega/vega-lite), [mermaid](https://github.com/knsv/mermaid), [sequence](https://github.com/bramp/js-sequence-diagrams) (#914)
-- Support create indent code block in preview mode.(#920)
-
-**:butterfly:Optimization**
-
-- Respect existing image title if no source is specified (#562)
-- Separate font and font size for code blocks and source code mode (#373, #467)
-- Opened files and opened directories/files can now be folded (#475, #602)
-- You can now hide the quick insert hint (#621)
-- Adjusted quote inline math color (#592)
-- Fix inline math text align (#593)
-- Added MIME type to Linux desktop file
-- What is the character and number of left-top? (#666)
-- Inserting Codeblock should automatically set cursor into language field (#684)
-- Upstream: prismjs highlighting issues (#709)
-- Improvements for "Open Recent" (#616)
-- Make table of contents in sidebar collapsible (#404)
-- Hide titlebar control buttons in custom titlebar style
-- Corrected hamburger menu offset
-- Optimization of inline html displa, now you can nest other inline syntax in inline html(#849)
-- Use CmdOrCtrl + C/V to copy rich text to `word`(Windows) or `page`(macOS) (#885)
-
-**:beetle:Bug fix**
-
-- Fix dark preview box background color (#587)
-- Use white PDF background color (#583)
-- Fix document printing
-- Restore default Mark Text style after exporting/printing
-- Prevent enter key as language identifier (#569)
-- Allow pasting text into the code block language text-box (#553)
-- Fixed a crash when opening a directory with an unknown file extension
-- Fixed an issue with `Save all` and `Delete all` buttons in the side bar
-- Fixed exception when exporting a code block (#591)
-- Fixed recommended filename
-- Fixed multiple sidebar issues
-- Fixed wrong font and theme when opening a directory (#696)
-- Switching to another tab will now work in source-code mode too (#606)
-- Fixed forced line break in a list is display wrong. (#672)
-- Relative images are broken after exporting (#678)
-- Unable to paste text in table cell(#670)
-- Wrong padding when copy loose list to tight list(#706)
-- Display Autocompletion in inline math(#673)
-- Unable to export a document when the language identifier is undefined(#591)
-- Incorrect rendering of pipe in code block within table(#660)
-- Using extended code identifiers breaks code blocks (#697)
-- Renderer exception when pasting text with new line(s) into a heading (#671)
-- Fatal error when a directory is removed (#661)
-- Wrong font and theme when opening file/directory (#696)
-- Automatically wrap code block lines when printing or exporting as PDF (#710)
-- Can't change tab in source code mode (#606)
-- Minor checkbox list bug (#576)
-- A hard line break followed by a list doesn't work in preview mode (#708)
-- Ctrl + X (#622)
-- Exception when removing a code block in a specific case (#568)
-- List items are always copied as loose list (#705)
-- Runtime bug when insert order list by quick insert (#760)
-- Image inside HTML is not loaded (#754)
-- No space around copy-pasted links (#752)
-- Relative image reference in HTML is broken (#782)
-- Selection cannot be cancelled by up / down keys (#630)
-- Cannot create table while in typewriter mode (#679)
-- Emojis don't work properly (#769)
-- Fixed multiple parser issues (update marked.js to v0.6.1)
-- Fixed nest math block issue (#586)
-- Can't make a comma-separated list of dollar ($) amounts (#740)
-- Fixed [...] is displayed in gray and orange (#432)
-- Fixed an issue that relative images are not loaded after closing a tab
-- Add symbolic link support
-- Fixed bug when combine pre list and next list into one when inline update #707
-- Fix renderer error when selection in sidebar (#625)
-- Fixed list parse error [more info](https://github.com/marktext/marktext/issues/831#issuecomment-477719256)
-- Fixed source code mode tab switching
-- Fixed source code mode to preview switching
-- Mark Text didn't remove highlight when I delete the markdown symbol like * or `. (#893)
-- After delete ``` at the beginning to paragraph by backspace, then type other text foo, the color will be strange, if you type 1. bar. error happened. (#892)
-- Fix highlight error in code block (#545 #890)
-- Fix files sorting in folder (#438)
-
-### 0.13.65
-
-**:butterfly:Optimization**
-
-- Show tab bar when opening a new tab
-- Use default bold (`CmdOrCtrl+B`) and italics (`CmdOrCtrl+I`) key binding (#346)
-- Don't show save dialog for an empty document (#422)
-- Sidebar and tab redesign
-- Calculate artifact checksum after uploading (#566)
-- Use `CmdOrCltr+Enter` to add table row bellow.
-
-**:beetle:Bug fix**
-
-- fix: #451 empty list item error
-- fix: #522 paste bug when paste into empty line
-- fix: #521
-- fix: #534
-- fix: #535 Application menu is not updated when switching windows
-- fix #216 and #311 key binding issues on Linux and Windows
-- fix #546 paste issue in table
-- fix: Blank document was always encoded as `LF`
-- fix: #541
-
-### 0.13.50
-
-**:cactus:Feature**
-
-- (#421) Add experiment function RTL support (#439)
-- feat: #487 Show filename while hovering over marktext file on dock
-- feat: export files in file menu
-- feat: drag to import
-- feat: quick insert paragraph
-- feat: inline format float box
-- feat: import files: TEX\ WIKI\ DOCX etc
-- feat: portable Windows application (#369)
-- feat: support search and replace in code block
-- feat: support GFM diff in code block
-- feat: suppoet quick input html in html block, eg: input div, press `tab` will auto input \<\/div>
-
-**:butterfly:Optimization**
-
-- Update linux documentation and remove snappy build (#381)
-- Update Japanese Document Latest Release Update.
-- add alfred workflow into readme (#394)
-- French translation of README.md (#398)
-- optimization: add gauss blur effect when open a modal (#407)
-- Improvement math preview styles (#419) (#424)
-- Turkish language translation for README.md (#427)
-- Improvement: #414 Add functional bracket auto-completion (#428)
-- feature: vscode debug config support (#446)
-- Exclude hard-line-break from printing. (#454)
-- export styled HTML with heading id's (#460)
-- opti: #485 Open Project command. Maybe rename to Open folder
-- Added Spanish translation (#499)
-- feat: add tooltip to editor
-- opti: #429 Support DataURL images (#480)
-- opti: rewrite image picker
-- opti: notify the user about the deletion url of the uploaded image
-- rewrite code block, html block, math block, front matter
-
-**:beetle:Bug fix**
-
-- fix download url in docs. (#379)
-- fix: #371 wrong paste behavior
-- fix: #380 wrong action of list shortcut
-- bugfix: inline math style error in list item (#405)
-- bugfix: #406 relative image path not display (#411)
-- bugfix: #400 (#410)
-- fix: wrong mouse click position #416 (#423)
-- fix: title bar resizing in north direction (#455)
-- fix: #441 #451 empty list item has no paragraph (#456)
-- fix: task list item centering (#457)
-- fix: #402 table of contents sidebar scroll bug (#461)
-- fix: recommend filename can be empty (#462)
-- Formatting cleanups (#463)
-- Arrow key up/down navigation in a table (#470)
-- fix: #481 add missing dot to parser markdown files only (#483)
-- fix: YAML frontmatter duplicates a new line on each opening of the file #494
-- fix(#431): broken math expression
-- fix(#434): no need to auto pair in math block
-- fix(#450) style error when render inline math
-- fix: #399 #476 #490 math render with style miss
-- fix: #393
-
-### 0.12.25
-
-**:cactus:Feature**
-
-**:butterfly:Optimization**
-
-- optimization: #361 easy sidebar toggle (#368)
-
-**:beetle:Bug fix**
-
-- fix: #348 do not export tabs and sidebar when export PDF
-- bugfix: #360 No page breaks in PDF export
-- bugfix: #167 #357 #344
-- fix: #343 Inconsistent color scheme in source code mode (#363)
-
-### 0.12.20
-
-**:cactus:Feature**
-
-- feature: file list in side bar: tree view and list view. #71
-- feature: search in project in side bar.
-- feature: table of content of the current edit file.
-- feature: copy table from Number(MacOs App)
-- feature: new file, new directory, copy, cut, paste, rename, remove to trash in side bar.
-- feature: save all the opened files and close all the opened files.
-- feature: Support reference link. #297
-- feature: Support reference image.
-- feature: copy table in context menu (#331)
-- feature: feedback via twitter
-- feature: can use delete key now, #301
-
-**:butterfly:Optimization**
-
-- optimization: rewirte table picker use popper
-- optimization: add animation to checkbox when clicked
-- Bundle desktop files and resources (#336)
-- Rewrite notification (#337)
-
-**:beetle:Bug fix**
-
-- fix: can not copy full link #312
-- fix: can not export table markdown #313
-- bugfix: #328 source code mode shortcut not work (#332)
-- bugfix: copy paste title delete text #321 (#333)
-- fix: text cursor skip lines in paragraph #330
-
-### 0.11.42
-
-**:cactus:Feature**
-
-- feature: add editorFont setting in user preference. (#175) - Anderson
-- feature: line break, support event and import and export markdown - Jocs
-- feature: unindent list item - Jocs
-- feature: Support for CRLF and LF line endings
-- feature: Click filename to `rename` or `save` in title bar(**macOS ONLY**).
-- feature: Support YAML Front Matter
-- feature: Support `setext` heading but the default heading style is `atx`
-- feature: User list item marker setting in preference file.
-- feature: Select text from selected table (cell) only if you press Ctrl+A
-- feature: Support Multiple lines math #242
-- feature: Support context menu: `copy`, `cut`, `paste`, `insert paragraph`, `edit table rows and columns` #169
-
-**:butterfly:Optimization**
-
-- ATX headings strictly follow the GFM Spec #177 - Jocs
-- no need to auto pair when * is to open a list item - Jocs
-- optimization: add sticky to block html tag - Jocs
-- Add Japanese readme (#191) - Neetshin
-- Disable update menu for snap and not supported packages (#196) - Felix Häusler
-- Check whether window size is larger than screen size (#192) - Felix Häusler
-- Add fallback editor font family (#209) - Felix Häusler
-- Use `partialRender` instead of `render` when render the file, this will speed up the render phase.
-- optimization: reduce the width of scroll bar in float box.
-- Smaller scrollbars and hover color (#245)
-- update electron to v2.0.2 [SECURITY]
-- Add support for tab indentation (#125)
-
-**:beetle:Bug fix**
-
-- fix: #94 history error
-- fix: #213 style error when render math
-- fix: the error 'Cannot read property 'forEach' of undefined' (#178) - 鸿则
-- fix: Change Source Code Mode Accelerator (#180) - Mice
-- fix: #153 Double space between tasklist checkbox and text - Jocs
-- fix: #198 navigation in table
-- fix: #190 Delete user settings on uninstall (NSIS) (#203) - Felix Häusler
-- fix: html block style error when active - Jocs
-- fix: PDF Export is contacted by LaTeX hightlight #194
-- fix: Table inside a list is not supported #202
-- fix: Cannot open file when window is started maximized or in full-screen mode #217
-- fix: #243 (#260)
-- fix: #232 (#259)
-- fix: #251
-- fix: #248 dark background disappears when export PDF (#252)
-- fix: #231 cut not work in code block
-- fix: #274 can not selection codes in code block when the cursor is outside of code block.
-- fix: frameless window drag
-- fix: #79 detect image type by mime type
-
-### 0.10.21
-
-**:notebook_with_decorative_cover:Note**
-
-You need uninstall the old version of Mark Text before install version 0.10.21, because we changed the AppId when build.
-
-**:cactus:Feature**
-
-- block html #110
-- raw html #110
-- you can now indent list items with tab key
-- auto pair `markdown syntax`, `quote`, `bracket`
-- ability to insert an empty line between elements #33
-- recently used documents on Linux and Windows (#139)
-
-**:butterfly:Optimization**
-
-- Update third-party packages to the latest version
-- Use HTTPS instead of HTTP (#158)
-- Add Polish readme (#154)
-- Optimization: sanitize html to avoid XSS attack #127 (#132)
-
-**:beetle:Bug fix**
-
-- fix: update outdated preferences on startup #100
-- fix: reset modification indicator after successfully saved changes
-- fix: disable tab focus
-- fix: strong and em parse error #116
-- fix horizontal line style #120
-- fix user preferences #122
-- fix: style error when export PDF/HTML with hr @Jocs
-- fix UTF-8 BOM encoding
-- fix: #162 support php language
-- fix: #152 emoji error
-- fix: #149 can not delete code block content
-
-### 0.9.25
-
-**:cactus:Feature**
-
-- display and inline math support #36
-- Image path auto complement #96
-- Feature: Toggle loose list item in paragraph menu #103
-- Add loose and tight list compatibility #74
-
-**:butterfly:Optimization**
-
-- adjust lineHeight and fontSize in typewriter mode
-- optimization of output unstylish html @fxha
-- Use 'fuzzaldrin' to filter language when insert code block
-- Optimization: Obey the GFM and optimization of thematic break update. - Jocs
-- Optimization: More than six # characters is not a heading So we don't need to highlight `#` - Jocs
-- Optimization: A closing sequence of # characters is optional when write ATX heading - Jocs
-- Optimization: watch image path change and rebuild the cache - Jocs
-- Update: update vue and snabbdom to the latest version - Jocs
-- Optimization: Use 'fuzzaldrin' to filter language when insert code block - Jocs
-- Update travis-ci (#92) - Felix Häusler
-
-**:beetle:Bug fix**
-
-- fix: #81
-- fix: #55
-- fix: #63
-- fix: crash on first launch due missing directory (#78, #90, #93)
-- fix: #101
-- Bugfix: #112 - Jocs
-- Bugfix: can not empty the content in source code mode #105 - Jocs
-- Bugfix: #107
-- fix: #88 (#108) - Felix Häusler
-- Allow exiting full screen with maximize button on windows (#109) - Felix Häusler
-- Bugfix: Caret can not move right when it's at the end of math format. #101 - Jocs
-
-
-### 0.8.12
-
-**:cactus:Feature**
-
-- Add user preferences in `Mark Text menu`, the shoutcut is `CmdorCtrl + ,`, you can set the default `theme` and `autoSave`.
-- Add `autoSave` to `file menu`, the default value is in `preferences.md` which you can open in `Mark Text menu`. #45
-- Add drag and drop to open Markdown file with Mark Text @fxha
-- User setting: fontSize, lineHeight, color in realtime mode.
-- Move your file to other folder @DXXL
-- Rename filename
-
-**:butterfly:Optimization**
-
-- Theme can be saved in user preferences now #16
-- Custom About dialog @fxha
-
-**:beetle:Bug fix**
-
-- fix: prevent open image or file directly when drag and drop over Mark Text #42
-- fix: set theme to all the open window not just the active one.
-- fix: set correct application menu offset on windows #44
-- fix: Missing preferences menu in Linux and Windows. @fxha
-
-### 0.7.17
-
-**Features**
-
-1. Check for updates..., and auto update when update available.(Still need signature...:cry:)
-
-2. Insert Image: ( In edit menu )
-
- - absolute path
-
- - relative path
-
- - Upload Image to cloud
-
-3. Add file icons to languages when create code block or change language in code block.
-
-**Bug fix**
-
-1. It's hard to focus the input in code fence.
-
-2. When input the language in code block, click the language item will not cause hide the float box.
-
-3. other bugs in code block.
-
-4. Windows user can not use open with feature.
-
-5. The menu disapear in Linux sysyem.
-
-6. Fix the bug that the language highlight disapear when open markdown file with code block
-
-7. remove the symbol in output styled html. #41
-
-8. escape the raw Markdown when open the markdown file. #37
-
-**Optimization**
-
-1. allow user to change install directory on windows.
-
-2. Show notification when output HTML and PDF successfully.
-
-3. update css-tree to latest version.
-
-4. Add lineWrapping is true to codeMirror config
-
-### 0.6.14
-
-**Features**
-
-- Add **dark** theme and **light** theme in both realtime preview mode and source code mode.
-
-- Insert `doutu` into the document, use CMD + / to open the panel.
-
-**Optimization**
-
-- Customize the scroll bar background color and thumb color.
-
-- Add collection of doutu.
-
-- Add History search word of doutu.
-
-**Bug fix**
-
-- Fix bug when search key in code block will cause the search input lose focus.
-
-- Fix the bug the editor will lose cursor after input Chinese.
-
-### 0.5.2
-
-**Features**
-
-- Add Typewriter Mode, The current line will always in the center of the document. If you change the current line, it will be auto scroll to the new line.
-
-- Add Focus Mode, the current paragraph's will be focused.
-
-- Add Dark theme, Light theme.
-
-**Optimization**
-
-- Optimize the display of path name and file name in title bar.
-
-- Eidtor will auto scroll to the highlight word when click Find Prev or Find Next.
-
-**Bug fix**
-
-- Set back the cursor when mode change between source code mode and normal mode
-
-### 0.4.0
-
-**Feature**
-
-- Search value in document, Use **FIND PREV** and **FIND NEXT** to selection previous one or next one.
-
- Add animation of highlight word.
-
- Auto focus the search input when open search panel.
-
- close the search panel will auto selection the last highlight word by ESC button.
-
-- Replace value
-
- Replace All
-
- Replace one and auto highlight the next word.
-
-**Bug fix**
-
-- fix the bug that click at the edge of code block will caused the code block does not be focused.
-
-**Optimization**
-
-- Optimize the display of word count in title bar. we also delete the background color of title bar to make it more concise.
-
-- Customize the style of checkbox in Task List Item.
-
-- Change the display of Insert Table dialog.
-
-### 0.3.0
-
-**Features**
-
-- Export PDF
-
-**Bug fix**
-
-- fix the bug that editor can only print the first page.
diff --git a/.github/COMMENTING-GUIDELINES.md b/.github/COMMENTING-GUIDELINES.md
new file mode 100644
index 0000000000..4d17097297
--- /dev/null
+++ b/.github/COMMENTING-GUIDELINES.md
@@ -0,0 +1,148 @@
+# Commenting Guidelines
+
+Distilled from John Ousterhout's *A Philosophy of Software Design* (ch. 12–16).
+One rule governs everything below:
+
+> **Comments should describe things that aren't obvious from the code.**
+
+A comment captures what was in the designer's mind but couldn't be expressed in
+the code itself — the rationale, the constraints, the abstraction. If a comment
+only restates the code, it has no value.
+
+---
+
+## What goes in a comment
+
+There is real design information that code cannot express: the informal meaning
+of a method, the units of a value, why a line exists, the rule the author
+followed ("always call `a` before `b`"). Comments exist to record exactly this.
+
+Comments also make abstraction possible. An abstraction hides complexity so you
+can use a module without reading its implementation — and the only way to
+describe an abstraction is in prose. Without comments, the sole abstraction of a
+function is its signature, which leaves out too much to be useful (does
+`substring(start, end)` include `end`? what if `start > end`?).
+
+So a comment is good when it sits at a **different level of detail** than the
+code: either lower (more precise) or higher (more intuitive). A comment at the
+same level as the code is just restating it.
+
+---
+
+## Rules
+
+**Don't repeat the code.** Before keeping a comment, ask: *could someone write
+this just by looking at the code next to it?* If yes, delete it. A special case
+of this: don't build the comment out of the words already in the name —
+`// Normalize the resource name` above `getNormalizedResourceName()` adds nothing.
+
+**Lower-level comments add precision.** Most valuable on declarations —
+instance variables, parameters, return values, where the name and type aren't
+enough. Spell out: units; whether bounds are inclusive or exclusive; what `null`
+means if allowed; who owns/frees a resource; any invariant ("this list always
+has at least one entry"). Describe what a variable *is*, not how the code
+mutates it — think nouns, not verbs.
+
+**Higher-level comments add intuition.** One sentence on what a block *does* and
+why, omitting the mechanics. A reader who has that sentence can explain the rest
+of the code themselves — and judge whether it's correct. These are harder to
+write: ask yourself "what is the simplest thing I can say that explains
+everything here?"
+
+**Separate interface from implementation comments.** Interface comments tell a
+caller what they need to use the thing — they *are* the abstraction.
+Implementation comments explain how it works inside. Never let one leak into the
+other. A caller should not have to read a method's body to call it correctly.
+
+ - *Class:* the abstraction it provides, what an instance represents, its
+ limitations. No method-by-method detail.
+ - *Method:* behavior from the caller's view; every parameter and the return
+ value, precisely; side effects; exceptions; preconditions. Keep
+ preconditions few, but document the ones that remain.
+ - The test for any fact: *does a caller need it to use this?* Wire formats,
+ internal data structures, transparent crash recovery — no, those are
+ implementation. A comparison being string-vs-integer, or whether requests
+ fire concurrently (affects performance) — yes.
+
+**Implementation comments say what and why, not how.** Most short methods need
+none. For longer ones, put a high-level line before each major block or
+non-trivial loop. Always explain anything subtle the code can't show — a
+bug-fix whose purpose isn't obvious gets a comment (reference the issue rather
+than restating it: `// Fixes #436 — autolink overrun on pasted URLs`).
+
+**Cross-module decisions need a findable home.** When a decision spans several
+files, document it where developers will actually trip over it — e.g. at the enum
+declaration they must edit, list every other place that needs updating. If
+there's no natural center, keep a `designNotes` file and point to it from each
+site (`// See "Zombies" in designNotes`).
+
+---
+
+## Write the comments first
+
+Comments written last are bad comments: by then you've checked out mentally, your
+memory of the design is fuzzy, and you write them by reading the code — so they
+repeat it.
+
+Instead, for a new class:
+
+1. Write the class interface comment.
+2. Write interface comments and signatures for the key public methods; leave the
+ bodies empty.
+3. Iterate until the structure feels right.
+4. Write declarations and comments for the key instance variables.
+5. Fill in the bodies, adding implementation comments as needed.
+
+When the code is done, the comments are done — there's no backlog. And it costs
+almost nothing: typing code and comments together is a small fraction of total
+development time.
+
+**A comment is a complexity detector.** The comment for a method or variable
+should be short *and* complete. If you can't write one that's both, the thing
+you're describing is probably badly designed — that's the signal to fix the
+design, not the comment.
+
+> 🚩 If the interface comment has to describe the implementation, the method is
+> too shallow. 🚩 If a comment merely repeats the code, it's noise. 🚩 If
+> something is hard to describe, the design has a problem.
+
+---
+
+## Keep them alive
+
+**Put the comment next to the code it describes.** The farther away, the less
+likely it gets updated. A method's interface comment belongs right by its body,
+not in a separate header. Push implementation comments down to the narrowest
+scope they cover rather than stacking them at the top. As a corollary: the
+farther a comment is from its code, the more abstract it should be.
+
+**Comments belong in the code, not the commit log.** If a future developer will
+need the information, put it where they'll see it. A commit message explaining a
+subtle fix is invisible to the next person who "simplifies" it back into a bug.
+
+**Don't duplicate.** Document each decision once, in the most obvious place, and
+reference it from the others. Don't re-document one module inside another, and
+don't restate things already in an external spec or manual — link to them.
+
+**Check the diff before committing.** Scan every change and confirm the
+surrounding comments still hold. This also catches stray debug code and stale
+TODOs.
+
+**Higher-level comments are easier to maintain** — they survive minor code
+changes because they don't depend on details. Reserve precise, detailed comments
+for the places that genuinely need them.
+
+---
+
+## Names are documentation too (ch. 14)
+
+A good name reduces the need for comments. Make names **precise** — `getCount()`
+counts *what*? — and make them **paint an image** of what the thing is and isn't,
+in two or three words. A single vague name once cost the author a six-month bug
+hunt: `block` meant both a disk block and a file block; `diskBlock` / `fileBlock`
+would have prevented it. Don't settle for "close enough."
+
+---
+
+**The test for any comment:** is it something you *couldn't* read off the code,
+and is it both short and complete?
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 2635946c40..33b6928388 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1,61 +1,70 @@
-# Mark Text Contributing Guide
+# MarkText Contributing Guide
-Hi, I'm really excited that you are interested in contributing to Mark Text :tada:. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
+We are really excited that you are interested in contributing to MarkText :tada:. Before submitting your contribution, please make sure to take a moment and read through the following guidelines.
-- [Code of Conduct](https://github.com/marktext/marktext/blob/master/.github/CODE_OF_CONDUCT.md)
-- [Issue Reporting Guidelines](#issue-reporting-guidelines)
-- [Pull Request Guidelines](#pull-request-guidelines)
+- [Code of Conduct](../packages/website/content/docs/dev/CODE_OF_CONDUCT.md)
+- [Philosophy](#philosophy)
+- [Issue reporting guidelines](#issue-reporting-guidelines)
+- [Pull request guidelines](#pull-request-guidelines)
- [Where should I start?](#where-should-i-start)
-- [Quick Start](#quick-start)
- - [Build Instructions](#build-instructions)
+- [Quick start](#quick-start)
+ - [Build instructions](#build-instructions)
- [Style guide](#style-guide)
-- [Project Structure](#project-structure)
+ - [Commenting guidelines](#commenting-guidelines)
+- [Developer documentation](#developer-documentation)
+
+## Philosophy
+
+🔑 Our philosophy is to keep things clean, simple and minimal.
+MarkText is constantly changing and we want these improvements to align with our philosophy. For example, look at the side bar and tabs; these two panels provide awesome functionality *and* aren't distracting to the user. We'll continue adding more features (like plugins) that can be activated via 'settings' to improve MarkText. This will allow everyone to customize MarkText for their needs and provide a minimal default interface.
## Issue Reporting Guidelines
-Please search for similar issues before opening an issue and always follow the [issue template](https://github.com/marktext/marktext/blob/master/.github/ISSUE_TEMPLATE.md). Please provide a detailed description of the problem in your PR and live demo or screenshots are preferred.
+Please search for similar issues before opening an issue and always follow the [issue template](.github/ISSUE_TEMPLATE/). Please review the following Pull Request guidelines before making your own PR.
## Pull Request Guidelines
-- Submit PRs directly to the `develop` branch.
+**In *all* Pull Requests:** provide a detailed description of the problem, as well as a demonstration with screen recordings and/or screenshots.
-- Work in the `src` folder and **DO NOT** checkin `dist` in commits.
+Please make sure the following is done before submitting a PR:
-- If you adding new feature:
-
- - Open a suggestion issue first.
- - Provide convincing reason to add this feature.
- - Then submit your PR.
+- Submit PRs directly to the `develop` branch.
+- Reference the related issue in the PR comment.
+- Utilize [JSDoc](https://github.com/jsdoc/jsdoc) for better code documentation.
+- Ensure all tests pass.
+- Please lint (`pnpm run lint`) your PR.
+- All PRs need to pass the **CI** before merged. If it fails, please try to solve the issue(s) and feel free to ask for any help.
-- If fixing a bug:
+If you add new feature:
- - If you are resolving a special issue, add `fix: #xxx[,#xxx]` (`#xxx` is the issue id) in your PR title for a better release log, e.g.`fix: #3899 update entities encoding/decoding`.
- - Update `.github/CHANGELOG.md` for notable changes - like bug fixes and features.
- - Provide detailed description of the bug in your PR and/or link to the issue. You can also include screenshots.
+- Open a suggestion issue first.
+- Provide your reasoning on why you want to add this feature.
+- Submit your PR.
-- Please lint and test your PR before submitting.
+If you fix a bug:
-- All PRs need to pass the **Travis CI** before merged. If it fails, please try to solve the issue(s) and feel free to ask for any help.
+- If you are resolving a special issue, please add `fix: # ` in your PR title (e.g.`fix: #3899 update entities encoding/decoding`).
+- Provide a detailed description of the bug in your PR and/or link to the issue.
### Where should I start?
-Find a issue flagged as a `bug`, `help wanted` or `enhancement `. The `good first issue` issues are good for new comers. Discuss the solution in the issue and after the final solution is approved by the Mark Text members, you can submit/work on the PR. For small fixes, you can directly open a PR.
+A good way to start is to find an [issue](https://github.com/marktext/marktext/issues) labeled as `bug`, `help wanted` or `feature request`. The `good first issue` issues are good for newcomers. Please discuss the solution for larger issues first and after the final solution is approved by the MarkText members, you can submit/work on the PR. For small changes you can directly open a PR.
Other ways to help:
-- Documentation (*1)
-- Translation (*1)
-- Help to answer `more detail` issues or discuss changes and features.
-- Report bugs and feature ideas.
+- Documentation
+- Translation (currently unavailable)
+- Design icons and logos
+- Improve the UI
+- Write tests for MarkText
+- Share your thoughts! We want to hear about features you think are missing, any bugs you find, and why you :heart: MarkText.
-***1**: More or less blocked until v1.0 release because of early development phase.
-
-## Quick Start
+## Quick start
1. Fork the repository.
2. Clone your fork: `git clone git@github.com:/marktext.git`
3. Create a feature branch: `git checkout -b feature`
-4. Make you changes and push your branch.
+4. Make your changes and push your branch.
5. Create a PR against `develop` and describe your changes.
**Rebase your PR:**
@@ -68,60 +77,21 @@ If there are conflicts or you want to update your local branch, please do the fo
### Build Instructions
-**Prerequisites:**
-
-Before you can get started developing, you need set up your build environment:
-
-- Node.js `>=v8.12.0`, npm and yarn
-- Python `v2.7.x` for node-gyp
-- C++ compiler and development tools
-
-**Additional development dependencies on Linux:**
+🔗 [Build Instructions](https://marktext.me/docs/dev/build)
-- libx11 (dev)
-- libxkbfile (dev)
+### Style Guide
-On Debian-based Linux: `sudo apt-get install libx11-dev libxkbfile-dev`
-On Red Hat-based Linux: `sudo dnf install libx11-devel libxkbfile-devel`
+You can run ESLint (`pnpm run lint`) to help you to follow the style guide.
-**Let's build:**
-
-1. Go to `marktext` folder
-2. Install dependencies: `yarn install` or `yarn install --frozen-lockfile`
-3. Build Mark Text: `npm run build`
-4. Mark Text binary is located under `build` folder
-
-Copy the build app to applications folder, or if on Windows run the executable installer.
-
-**Important scripts:**
-
-```
-$ npm run
+