Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gdatasoftwareag/funcydown
A simple functional library to create Markdown files.
https://github.com/gdatasoftwareag/funcydown
fable fsharp markdown
Last synced: 2 days ago
JSON representation
A simple functional library to create Markdown files.
- Host: GitHub
- URL: https://github.com/gdatasoftwareag/funcydown
- Owner: GDATASoftwareAG
- License: mit
- Created: 2019-04-01T13:32:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-23T10:10:27.000Z (about 2 months ago)
- Last Synced: 2024-11-06T04:40:37.335Z (8 days ago)
- Topics: fable, fsharp, markdown
- Language: F#
- Homepage:
- Size: 106 KB
- Stars: 44
- Watchers: 14
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![FuncyDown Logo](https://github.com/GDATASoftwareAG/FuncyDown/blob/master/resource/linkedin_banner_image_1.png?raw=true "Markdown - FuncyDown")
[![license](https://img.shields.io/github/license/GDATASoftwareAG/FuncyDown.svg)](https://raw.githubusercontent.com/GDATASoftwareAG/FuncyDown/master/LICENSE)
[![NuGet](https://img.shields.io/nuget/v/FuncyDown.svg)](https://www.nuget.org/packages/FuncyDown/)
[![NuGet](https://img.shields.io/nuget/dt/FuncyDown.svg)](https://www.nuget.org/packages/FuncyDown/)
[![Build](https://img.shields.io/azure-devops/build/gdatasoftware/FuncyDown/4.svg)](https://dev.azure.com/gdatasoftware/FuncyDown/_build?definitionId=4)
[![Test](https://img.shields.io/azure-devops/tests/gdatasoftware/FuncyDown/4.svg)](https://dev.azure.com/gdatasoftware/FuncyDown/_build?definitionId=4)
FuncyDown is a very simple library to create Markdown files written in F#. The readme you are currently reading is generated with FuncyDown.
## How to use
These examples show how to use FuncyDown in your application to create a Markdown file.
### Headers
You can easily add headers of different size to your Markdown document.
```fsharp
open FuncyDown.Element
open FuncyDown.DocumentemptyDocument
|> addH1 "Header size 1"
|> addH2 "Header size 2"
|> addH3 "Header size 3"
|> addH4 "Header size 4"
|> addH5 "Header size 5"
|> addH6 "Header size 6"
|> addHeader H3 "Header of specific size (example 3)"
```
### Working with textThere are several option to work with text.
```fsharp
emptyDocument
|> addParagraph "Text to put into an paragraph."
|> addEmphasis "Text to emphasize (italic)."
|> addStrongEmphasis "Text to strongly emphasize (bold)"
|> addStrikeThrough "Text to strike through."
```
### TablesAdding a table is also very easy.
```fsharp
let headers = ["Header 1"; "Header 2"; "Header 3"]
let rows =
[
["Content"; "Content"; "Content"]
["Content"; "Content"; "Content"]
["Content"; "Content"; "Content"]
]
emptyDocument
|> addTable headers rows
```
### ListsYou can create ordered and unordered list with sub-items.
```fsharp
let items =
[
{Text = "Level 0 item."; Intend = 0}
{Text = "Level 1 item."; Intend = 1}
{Text = "Level 2 item."; Intend = 2}
{Text = "Level 0 item."; Intend = 0}
]emptyDocument
|> addUnorderedList items
|> addOrderedList items
```
### Links and ImagesYou can add a link to an internal or external reference and to images which will be displayed in the Markdown document.
```fsharp
emptyDocument
|> addLink {Text = "Some link text"; Target = "https://.../index.html"; Title = Some("Optional title")}
|> addImage {AltText = "Some link text"; Target = "https://.../image.png"; Title = Some("Optional title")}
```
### CodeTo add code, you have two option. Either as in-line code or as a code block.
```fsharp
emptyDocument
|> addInlineCode {Code = "Inline code"; Language = None}
|> addBlockCode {Code = "Inline code"; Language = Some("fsharp")}
```
### Block QuoteSometimes it's useful to have a block quote to highlight some text or quote a source.
```fsharp
emptyDocument
|> addBlockQuote "Text to quote."
```
### Horizontal RuleTo add a simple horizontal rule use the code below.
```fsharp
emptyDocument
|> addHorizontalRule
```
### Create Document from elementsAs an alternative to the pipe operator, the `toDoc` function can be used to construct a Markdown document.
```fsharp
let document = Document.toDoc [
addH1 "FuncyDown is fancy!"
addParagraph "Lemonade was a popular drink, and it still is!"
]
```
### Render DocumentThe render function writes directly to a Markdown string.
```fsharp
let markdown = Document.render [
addH1 "FuncyDown is fancy!"
addParagraph "Lemonade was a popular drink, and it still is!"
]
```
### Export to stringTo save the generated Markdown document on disk or use it otherwise, you can export the document to a formatted Markdown string.
```fsharp
...
markdownDocument |> asString
```