I realized MarkdownConf will just reimplement YAML. Repository is archived now for reference.
Markdown Config is a Markdown language parser for configuration files base on Kotlin!
The code style will focus on readability and usability.
Markdown Config is using Kotlin Multiplatform and currently supports JVM and JavaScript.
The type of individual values will always be String
on JVM platform, or dynamic
on JavaScript.
In this document, [value1, value2, ...]
represents a list and {key1=value1, key2=value2, ...=...}
represents a map.
The following markup will be parsed as either Map<String, String>
on JVM platform, or Map<String, dynamic
on JavaScript.
key: value
For boolean values:
- [x] key
is equivalent tokey: true
.true
is aString
.- [ ] key
is equivalent tokey: false
.false
is aString
.
Special cases:
key with space: value with space
->{"key with space"="value with space"}
multiple-colons: :::
->{"multiple-colons"=":::"}
: The text before the first colon will be the key.no-space-after-colon:value
->{"no-space-after-colon"="value"}
: Markdown Config will still parse this correctly, however it's not encouraged.key: "string"
->{"key"="\"string\""}
: The quotation mark will become part of the value. Don't include it if unnecessary.
Any line started with >
or any italic text (surround by *
or _
) will be the comment.
> This is a comment
key: value *This is another comment*
The following markup will be parsed as a list named Tasks
with value ["Build", "Debug", "Release"]
Start a line with any of -
*
or numbers have the same effect.
The size of heading (number of #
before the key) depends on its parents heading. It will be described later.
#### Tasks
- Build
- Run
- Release
Similarly, you can create a map named Commands
with value {"Build"="gradle build", "Run"="gradle run", "Release"="git push"}
using following markup.
#### Commands
- Build: gradle build
- Run: gradle run
- Release: git push
This example is complicated, an explanation is below.
#### Commands
- Build: gradle build
- Run: gradle run
- Debug: true
- Release: *This colon is optional*
- GitHub: git push
- AppStore: xcrun altool
- Beta: true
- Tester: *This colon is optional*
- A
- B
- C
The map Commands
with multi types is parsed as:
{
"Build"="gradle build",
"Run"={
"Run"="gradle run",
"Debug"="true"
},
"Release"={
"GitHub"="git push",
"AppStore"={
"AppStore"="xcrun altool",
"Beta"="true",
"Tester"=["A", "B", "C"]
}
}
This table will be parsed as a list of map named Deatail
. The value will be [{"Task"="commonMain", "Require Test"="True", "Time Limit"="1 second"}, {"Task"="jvmMain", "Require Test"="True", "Time Limit"="2 seconds"}, {"Task"="jsMain", "Require Test"="False"}]
Note that a key with missing value will not be included in the resultant map.
#### Detail
| Task | Require Test | Time Limit |
| ---------- | ------------ | ---------- |
| commonMain | True | 1 second |
| jvmMain | True | 2 seconds |
| jsMain | False | |
Structure is used to categorize keys.
# H1
## H2
### H3
#### H4
##### H5
###### H6
- Normal text without colon
- Numbered list
1. text
- Images
![text](url)
- Link
[text](url)
- Inline code
``
and Code block``````
- Bold
**text**
or__text__
- Strikethrough
~~Text~~
- Horizontal rule
---
***
or___
- Implement the scheme
- Multiplatform support
- Use data class as custom types.