ken-markup is a markup language made for family websites of ken-zone.
Here is a demo website of ken-markup (in Korean).
-
Install the module
$ npm i ken-markup
-
Import the module
import Translator from 'ken-markup'
You can import it with a different name (i.e. instead of Translator) if you want.
-
Translate the text
translatedText = Translator.translate(originalText);
- It converts text into HTML elements.
- It supports enough grammar to write basic articles.
- It makes an index table and footnotes automatically.
- Anyone can design it since it returns raw HTML code.
-
**bold**
-
//italic//
-
~~delete~~
-
__under__
-
^^sup^^
-
,,sub,,
-
[[link]]
You can show different text to the text of the link by using
|
;ex) [[name|link]] -> name // The href will be the link
If you want to add some rules to the link text, you can override the
parseAnchorLink
method of the class. -
((note))
You can set the index of notes as texts by using
|
.ex) ((index|note)) -> [index] // The content will be the note
-
# title
Title grammar has five levels which can be changed by the count of
#
.ex) # title 1. ## title 1.1. ## title 1.2. # title 2.
-
:[table]:
Table grammar starts with
:[
and ends with]:
.To divide columns, insert
][
between the line.To divide rows, insert
\n][
or]\n[
into the end of the line that you want to break.ex) :[cell(0,0)][cell(0,1) ][cell(1,0)][cell(1,1)] [cell(2,0)][cell(2,1)]:
-
:(unordered list):
Unordered list grammar starts with
:(
and ends with):
.To divide items, use
)(
,\n)(
, or)\n(
. You can use any of these, even mixed.ex) :(item1 )(item2) (item3)(item4):
-
:{ordered list}:
The difference between ordered and unordered is only the change from
(
to{
.ex) :{item1 }{item2} {item3}{item4}:
-
---- horizontal rule
Four
-
are converted into a horizontal rule, which can be used to separate sections or contents.ex) ----
There should be a line break (\n) before this grammar.
-
\ ignoring grammar
Put the
\
character in front of the grammar that you want to ignore.
- Images
- Font-size
- Text-align
- Text-color
- Indent
- Quotes
- Code
- Math(equations)