DEV Community

loading...

Make the stylish editor with CodeMirror.

daniel123 profile image Daniel ・4 min read

I have been making a markdown editor called Boostnote using Codemirror.
Enable you to switch theme in Editor and Codeblock in Markdown Preview, I write how to make this feature in this article.

Feature

  • Switching the theme at editor and code-block in markdow preview of Boostnote
  • Users can choose their favorite theme.

image-gif

How to make

①Installing the codemirror.

Since we mainly use React when making Boostnote, install the package using npm.
npm install codemirror --save

②Check the contents of the installed codemirror package.
cd node_modules/codemirror/theme

Many kinds of themes are automatically installed.

They are the same as those here. https://github.com/codemirror/CodeMirror/tree/master/theme

③Introducing the installed themes!
1.default
1

2.3024-day
2

3.3024-night
3

4.abcdef
4

5.ambiance-mobile
5

6.ambiance
6

7.base16-dark
7

8.base16-light
8

9.bespin
9

10.blackboard
10

11.cobalt
11

12.colorforth
12

13.dracula
13

14.duotone-dark
14

15.duotone-light
15

16.eclipse
16

17.elegant
17

18.erlang-dark
18

19.hopscotch
19

20.icecoder
20

21.isotope
21

22.lesser-dark
22

23.liquibyte
23

24.material
24

25.mbo
!25](https://cdn-images-1.medium.com/max/1600/1*O-UBKKw--7t_EhRMXG8p-g.png)

26.mdn-like
26

27.midnight
27

28.monokai
28

29.neat
29

30.neo
30

31.night
31

32.panda-syntax
32

33.paraiso-dark
33

34.paraiso-light
34

35.pastel-on-dark
35

36.railscasts
36

37.rubyblue
37

38.seti
38

39.solarized dark
39

  1. solarized light 40

41.the-matrix
41

42.tomorrow-night-bright
42

43.tomorrow-night-eighties
43

44.ttcn
44

45.twilight
45

46.vibrant-ink
46

47.xq-dark
47

48.xq-light
48

49.yeti
49

50.zenburn
50

That's all ;)

CodeMirror docs is here.

Enjoy CodeMirror and Boostnote!


Discussion

pic
Editor guide
Collapse
mortoray profile image
edA‑qa mort‑ora‑y

Thank you for using a proportional font. Down with monospace!

Collapse
alephnaught2tog profile image
M. Shemayev

Why don't you like monospace? Genuinely curious.

Collapse
mortoray profile image
edA‑qa mort‑ora‑y

Proportional fonts have better aesthetics as they better match the way letters evolved and how we see them in day-to-day life. They occupy the "right" amount of space instead of being crammed into, or stretched into a fixed cell: compare "m" to "n". I can read proportional text faster, with less eye strain.

Now with Unicode, and wide spread prevalence of international characters, and emoji, the issues with monospaced have become more pronounced.

Oh, and yeah, monospace leads to people doing stupid formatting in their source code.

Collapse
sorensenriis profile image
Mathias Riis Sorensen

I didn't find my favorite theme, which is the standard theme for Xcode. Any change that you guys know how to implement it? Or a way to make custom themes?