Skip to content

Commit

Permalink
table of contents
Browse files Browse the repository at this point in the history
  • Loading branch information
mfwgenerics committed Jan 11, 2023
1 parent da18d6b commit 0bebbe9
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 161 deletions.
9 changes: 9 additions & 0 deletions docs/BASIC.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Basic Syntax

1. [Headers](#headers)
2. [Paragraphs](#paragraphs)
3. [Emphasis](#emphasis)
4. [Blockquotes](#blockquotes)
5. [Lists](#lists)
6. [Code](#code)
7. [Horizontal Rules](#horizontal-rules)
8. [Links](#links)

## Headers

### Kotlin
Expand Down
3 changes: 3 additions & 0 deletions docs/EXTENDED.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Extended Syntax

1. [Tables](#tables)
2. [Footnotes](#footnotes)

## Tables

### Kotlin
Expand Down
272 changes: 137 additions & 135 deletions readme/src/main/kotlin/Basic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,176 +17,178 @@ fun <T> Markdown.code(code: CapturedBlock<T>): T = code("kotlin", code)
fun Markout.basic() = markdown("BASIC") {
h1("Basic Syntax")

h2("Headers")

example {
h1("Header 1")
h2("Header 2")
h3("Header 3")
h4("Header 4")
h5("Header 5")
h6("Header 6")
}

h2("Paragraphs")

example {
p {
+"This text will appear in a paragraph."
+" "
+"This sentence will be grouped with the preceding one."
}

p("""
A second paragraph.
Line breaks won't
affect the markdown layout
""".trimIndent())
}

h2("Emphasis")

example {
p {
b("Bold")
+", "
i("Italics")
+" and "
b { i("Bold italics") }
+"."
}

p {
/* same as above, using `+` syntax sugar */
b("Bold") + ", " + i("Italics") + " and " + b { i("Bold italics") } + "."
}

p {
+"For inline text styling you can *still* use **raw markdown**"
}
}

h2("Blockquotes")

example {
+"I'm about to quote something"

quote {
+"Here's the quote with a nested quote inside"

quote {
+"A final inner quote"
sectioned {
section("Headers") {
example {
h1("Header 1")
h2("Header 2")
h3("Header 3")
h4("Header 4")
h5("Header 5")
h6("Header 6")
}
}
}

h2("Lists")

example {
+"Dot points"
section("Paragraphs") {
example {
p {
+"This text will appear in a paragraph."
+" "
+"This sentence will be grouped with the preceding one."
}

ul {
li("Dot point 1")
li("Another point")
li("A third point")
p("""
A second paragraph.
Line breaks won't
affect the markdown layout
""".trimIndent())
}
}

+"Numbered"
ol {
li("Item 1")
li {
section("Emphasis") {
example {
p {
+"You can nest any markdown inside list items"
b("Bold")
+", "
i("Italics")
+" and "
b { i("Bold italics") }
+"."
}

p {
+"Multiple paragraphs"
/* same as above, using `+` syntax sugar */
b("Bold") + ", " + i("Italics") + " and " + b { i("Bold italics") } + "."
}

quote {
+"Or even a quote"
}
}
li {
ol {
li("This includes")
li("Lists themselves")
p {
+"For inline text styling you can *still* use **raw markdown**"
}
}
}

+"Task lists"
cl {
li(true, "Create a markdown DSL")
li(true, "Add task list support")
li(false, "Solve all of the world's problems")
}
}
section("Blockquotes") {
example {
+"I'm about to quote something"

h2("Code")
quote {
+"Here's the quote with a nested quote inside"

example {
c("Inline code block")
quote {
+"A final inner quote"
}
}
}
}

code("multiline\ncode\nblocks")
section("Lists") {
example {
+"Dot points"

code("kotlin", """
fun main() {
println("Syntax hinted code!")
}
""".trimIndent())
ul {
li("Dot point 1")
li("Another point")
li("A third point")
}

val result = code {
/* this code block runs */
fun square(x: Int) = x*x
+"Numbered"
ol {
li("Item 1")
li {
p {
+"You can nest any markdown inside list items"
}

p {
+"Multiple paragraphs"
}

quote {
+"Or even a quote"
}
}
li {
ol {
li("This includes")
li("Lists themselves")
}
}
}

square(7)
+"Task lists"
cl {
li(true, "Create a markdown DSL")
li(true, "Add task list support")
li(false, "Solve all of the world's problems")
}
}
}

+"Code executed with result: "
c("$result")
}
section("Code") {
example {
c("Inline code block")

h2("Horizontal Rules")
code("multiline\ncode\nblocks")

example {
t("Separated")
hr()
t("By")
hr()
t("Hrs")
}
code("kotlin", """
fun main() {
println("Syntax hinted code!")
}
""".trimIndent())

h2("Links")
val result = code {
/* this code block runs */
fun square(x: Int) = x*x

example {
p {
+"Visit "
a("https://example.com", "Example Website")
}
square(7)
}

p {
a("https://example.com") {
+"Links "
i("can contain")
+" "
b("inner formatting")
+"Code executed with result: "
c("$result")
}
}

p {
a(cite("https://example.com"), "Reference style link")
section("Horizontal Rules") {
example {
t("Separated")
hr()
t("By")
hr()
t("Hrs")
}
}

p {
+"Reference "
a(cite("https://example.com"), "links")
+" are de-duplicated"
}
section("Links") {
example {
p {
+"Visit "
a("https://example.com", "Example Website")
}

p {
a("https://example.com") {
+"Links "
i("can contain")
+" "
b("inner formatting")
}
}

p {
a(cite("https://example.com", "Example"), "References")
+" can be titled"
p {
a(cite("https://example.com"), "Reference style link")
}

p {
+"Reference "
a(cite("https://example.com"), "links")
+" are de-duplicated"
}

p {
a(cite("https://example.com", "Example"), "References")
+" can be titled"
}
}
}
}
}
Loading

0 comments on commit 0bebbe9

Please sign in to comment.