Mark Cook1.2-Simple and Efficient markdown Editor
It’s very simple, efficient and has nothing to spare.
She has many advantages:
Live preview, WYSIWYG, no need to worry about typesetting.
A complete set of shortcut buttons are provided, and typesetting can be carried out without consulting markdown syntax.
For a single-page application that is completely offline, the file clone of gh-pages branch can be downloaded and used as a local client.
Provides local caching to prevent loss of important content.
Drag and drop imported files to edit local files conveniently and quickly.
File export is supported and can be saved directly after writing.
Markcook 1.2: Fixed a bug that could not export Chinese files and added the function of dragging and dropping imported files.
Markcook 1.1: File export function is added to export
Markcook 1.0: Basic version, only capable of synchronously compiling markdown syntax.
Quick Insert markdown Symbol
Drag and drop upload file
Caching and Downloading
It has been more than three months since the release of version 1.0. At that time, version 1.0 was still very original and did not intend to continue maintenance. Later, by chance, I felt that I should improve the basic functions for it, at least I have to support import and export. At the same time, as graduation was approaching and I was too busy, I took it out again and added some practical functions.
Drag and drop upload mainly uses the file API newly added in HTML5, which can read local files. Through file API, the real backend free can be realized, and files can be uploaded for editing without backstage! The specific code is as follows (including drag and drop upload function):
In order to provide the file export function, I checked a lot of data and also asked questions in sf community:How can html templates generated by js be downloaded?
Thank@cool_zjyHowever, the biggest drawback is that base64 encoding does not support Chinese characters. If transcoding is done through a third-party library, the downloaded content is also transcoded characters, which does not meet the requirements. Later, after research, another method, also an API provided by HTML5, was adopted.
Blob()Receives an array as a parameter and generates an encoded object. Pass in the encoded object as a parameter
URL.createObjectURL(), you can generate a link that can be downloaded. The downloaded content is perfect Chinese characters (other types of characters are also supported). The code is as follows:
These are the implementation principles of the two key new functions. In addition to providing uploading and downloading, the file API of HTML5 has many interesting and powerful functions, which deserve further study.
Finally, through electron packaging, desktop programs suitable for the whole platform are generated. in my github release, the 64-bit version of windows and OSX mas version have been uploaded.
The OSX and Linux versions will be uploaded later.. The following is a screenshot of the Windows version:
Through the development of Markcook, I found that the vuejs+webpack generated project is very suitable for desktop application migration through Electronics, because the vuejs project generated through webpack has only one index.html entry file and the rest are js files. It is extremely convenient to directly generate desktop application through Electronics by simply modifying the file directory structure. Thank you here@ Remote Intelligence HeroThe articleDeveloping Desktop Applications from scratch with Electron+jQuery (1) HelloWorld, introduces the basic usage of electron in detail.
Write at the end
Next, looking at mood maintenance, I may adjust LOGO and UI later, because it is quite crude now. At the same time, because of laziness, I didn’t make a response. I’ll reconstruct it later.
If you think my work is ok, welcome follow and look forward to your PR. Although it is a simple work, I still hope to get your advice, thank you! !