Updated novice tutorial for non-technical people:
[Part 1: Basic Principles] "Good News for Lazy People: How to be a WeChat editor who never does typesetting?" 》
[Next article: Grammar Guide] "Complete Guide to MarkDown Typesetting for WeChat Official Accounts"
Download the latest stable version: Windows version/Mac version
.md
file, and put it in the temp
directory.maxpress
program, and a .html
file with the same name will be generated in the result/html
directory..html
file with a browser, select all, copy, and paste into the WeChat editor.【Notes】
.md
files and multiple subdirectories (including nested subdirectories)..md
files will be moved to the result/archive
directory after conversion. This function can be disabled by modifying the configuration file (auto_archive). Before running the conversion program, modify the config.json
file to customize common format variables.
include:
variable name | default value | illustrate |
---|---|---|
main_size | 16px | Main text size |
theme_color | #349971 | Theme color, used for text colors such as titles, emphasis elements, etc. |
text_color | #555 | Body text color |
quote_color | #999 | Text color in reference box and code box |
line_height | 2em | Text line height |
para_spacing | 1.5em | Text paragraph spacing |
align | Multiple | The horizontal alignment of each part is recommended to left or center ( h1 ~ h6 represent title 1 ~ title 6, content represents the main text) |
main_margin | 3% | The proportion of white space on both sides of the content |
banner_url | "" | The URL of the image in the article header that guides attention |
poster_url | "" | The QR code/address of the poster image at the bottom |
convert_list | true | Convert the list in the text into an ordinary paragraph to correct the problem that WeChat cannot display the list sequence number style properly (only for WeChat) |
ul_style | "○" | Symbol identification before each item after converting an unordered list into a normal paragraph (only enabled when convert_list is true ) |
auto_archive | "" | Whether to automatically archive (move the original .md file to the result/archive directory after conversion) |
auto_rename | false | Handling of conflicting file names: true automatically rename; false to overwrite the previous file |
Remark:
theme_color
, and the rest can use the default configuration.convert_list
option as a temporary solution. When this option is true
, all lists in the body (excluding content in code blocks) will be converted into ordinary paragraphs with serial numbers at the beginning of the paragraph. Note that in this case, the styles set specifically for the list in styles.less
will be invalid. If you have a better way, please open an issue and let me know. If you want to override individual styles in the default styles, you can write custom.css
yourself, which will be imported after default.css
.
example.md
-> example.html
(please download html and open it in the browser)
Examples of public account articles: Complete guide to MarkDown formatting for WeChat public accounts
If you have a Python environment installed on your computer, you can run the script directly. It is recommended to get the latest stable version from the Master branch.
Developed using Python 3.5.2, CSS stylesheets are compiled using LESS. It is recommended to use it in Python 3 environment.
Dependent packages: mistune, premailer, lesscpy
Quickly install dependencies: pip install -r requirements.txt
Run directly: python maxpress.py
Or import as a module:
import maxpress
maxpress.convert_all(archive=True, styles=None)
If you want to completely abandon the default style and enable a custom CSS style sheet, you can pass in the custom CSS file path through styles
parameter (supports passing in multiple lists), then the parameters used to define the style in config.json
will be will fail, custom.css
will be imported after all your custom stylesheets.
When a styled list is pasted into the WeChat editor, the format may be accidentally lost (it seems to be a WeChat bug?). Currently, this can be temporarily solved by adding an additional span
element packaging style to each li
element. But please note that if you customize the style, the font size, color, etc. set for li span
cannot be exactly the same as the upper-level element, otherwise it will be automatically removed when pasted into the WeChat editor.
example.md
-> example.html
(please download html and open it in the browser)
For design ideas and some default styles, please refer to:
markdownhere.css
MIT