|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "markdown" for Markdown
|
|
|
|
System.print(Markdown.fromHtml("<h1>Title</h1>")) // expect: # Title
|
|
System.print(Markdown.fromHtml("<h2>Subtitle</h2>")) // expect: ## Subtitle
|
|
System.print(Markdown.fromHtml("<h3>Section</h3>")) // expect: ### Section
|
|
System.print(Markdown.fromHtml("<h4>Subsection</h4>")) // expect: #### Subsection
|
|
System.print(Markdown.fromHtml("<h5>Minor</h5>")) // expect: ##### Minor
|
|
System.print(Markdown.fromHtml("<h6>Smallest</h6>")) // expect: ###### Smallest
|
|
|
|
System.print(Markdown.fromHtml("<strong>bold</strong>")) // expect: **bold**
|
|
System.print(Markdown.fromHtml("<b>bold</b>")) // expect: **bold**
|
|
|
|
System.print(Markdown.fromHtml("<em>italic</em>")) // expect: *italic*
|
|
System.print(Markdown.fromHtml("<i>italic</i>")) // expect: *italic*
|
|
|
|
System.print(Markdown.fromHtml("<code>code</code>")) // expect: `code`
|
|
|
|
System.print(Markdown.fromHtml("<del>deleted</del>")) // expect: ~~deleted~~
|
|
System.print(Markdown.fromHtml("<s>strike</s>")) // expect: ~~strike~~
|
|
|
|
System.print(Markdown.fromHtml("<a href=\"https://example.com\">Example</a>")) // expect: [Example](https://example.com)
|
|
|
|
System.print(Markdown.fromHtml("<img src=\"image.png\" alt=\"My Image\">")) // expect: 
|
|
|
|
var ul = Markdown.fromHtml("<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>")
|
|
System.print(ul.contains("- Item 1")) // expect: true
|
|
System.print(ul.contains("- Item 2")) // expect: true
|
|
System.print(ul.contains("- Item 3")) // expect: true
|
|
|
|
var ol = Markdown.fromHtml("<ol><li>First</li><li>Second</li><li>Third</li></ol>")
|
|
System.print(ol.contains("1. First")) // expect: true
|
|
System.print(ol.contains("2. Second")) // expect: true
|
|
System.print(ol.contains("3. Third")) // expect: true
|
|
|
|
var bq = Markdown.fromHtml("<blockquote>Quote text</blockquote>")
|
|
System.print(bq.contains("> Quote text")) // expect: true
|
|
|
|
System.print(Markdown.fromHtml("<hr>").contains("---")) // expect: true
|
|
System.print(Markdown.fromHtml("<hr/>").contains("---")) // expect: true
|
|
|
|
var p = Markdown.fromHtml("<p>First paragraph</p><p>Second paragraph</p>")
|
|
System.print(p.contains("First paragraph")) // expect: true
|
|
System.print(p.contains("Second paragraph")) // expect: true
|
|
|
|
var br = Markdown.fromHtml("Line one<br>Line two")
|
|
System.print(br.contains("Line one")) // expect: true
|
|
System.print(br.contains("Line two")) // expect: true
|