This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
Comments can be entered into the lucky draw, details can be seen at the end of the article.
preface
I wrote a new editor theme for the National Day and it was successfully launched, which is the theme of this article. Many friends in the comment section said that they need a tutorial, so today I will bring a whole process graphic tutorial.
A quick word on what is needed:
- Node.js
- Git
- Arbitrary editor
- A little CSS basics + a little aesthetics + a little imitation ability to create something new
Create a project
-
Open the official nuggets template and click the green Use the Template button:
-
Click on this button to create a new repository, use juejin-markdown-theme- your theme name, and click on create in green:
-
Once created, you can use Git Clone or the editor’s graphical interface to clone the project locally:
-
Git clone, Google CDN, Stack Overflow, and dev-Sidecar.
-
With git Clone and vscode, open the command line and type:
-
The first step is complete:
Start Coding
-
Modify the LICENSE file first, which is easy to forget (JSON files can be modified or deleted, but I deleted them directly) :
-
Nuggets provides theme development tools that can be typed at the command line:
cd <yourThemeProject> npx juejin-theme-devtool <yourStyleFile> Copy the code
-
Something like this:
-
Open http://localhost:3000 to modify and preview:
-
Then you can start to write code, either using CSS or SCSS, SCSS is recommended (save a lot of work and there is no learning cost), you can modify the template a little bit, you can also download someone else’s reference, such as Mancuoj/Chinese-Red.
-
Find color, change style, view preview three-step cycle 🔥
-
Once you’re done, you can push it to the Github repository (no more details) if you think the preview looks good.
Submit a PR
-
Fork the official nuggets repository and clone it locally, or modify it directly from the web.
-
Modify theme.js by adding the following items, with highlight omitted and the comma:
-
Ref is the commit hash value generated by your theme repository upload:
-
To add your name to readme. md, just write the following: warehouse address + Nuggets home page +MIT:
-
To submit pr, open the repository you forked in and click Pull Requests:
-
Add xx theme to main and fill in the description:
-
Open the official warehouse to see your PR:
-
There are some automatic checks to check your results:
-
If the test is not successful, there will be ×, at this time you need to compare with other PR passed to modify:
-
You can also click Details to see the results of the deployment:
-
Change front-matter to see:
-
Next is waiting for the big guy to merge.
List of reference topics
Reference topic | The author |
---|---|
juejin | |
smartblue | Tusi |
cyanosis | Lin Xiaoshuai |
Minority (sspai.com) | |
typora-theme-misty | etigerstudio |
typora-theme-pie | kevinzhao2233 |
typora-theme-ursine | noatpad |
My-Typora-Themes | Theigrams |
DrakeTyporaTheme | liangjingkanji |
typora-vue-theme | blinkfox |
hydrogen | DawnLck |
juejin-markdown-theme-fancy | xrr2016 |
Chinese-red | Mancuoj |
Some of the pit
Development tool Preview
跟Preview in PR
跟Actually behind the line
Each of the three styles has a slight difference. Try to use PX as a unit rather than REM or EM.- Need to pay attention to
While the code
及Code box
The difference between. - The task list
- [x]
Grammar requires extra attention, as I have learned. - Table style and display in dark mode.
- Font style and size.
- Changes made after PR submission need to be synchronized
commit hash
. - Try to be clean, not too fancy, consider the overall compatibility, background images and what can be spared.
- Others want to add 😊
In general, it is quite simple. I hope you can contribute more and let me have more choices.
I am Mancuoj, if there is any doubt or stepped on what pit can comment message, I will reply, for a praise 👍
Please feel free to discuss in the comments section. The nuggets will draw 100 nuggets in the comments section after the diggnation project. See the event article for details.