Skip to content

Commit 1c57802

Browse files
committed
docs(MarkdownBuilder): add docs
1 parent eb327d7 commit 1c57802

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ You can show `Array` or `Hash` values as html lists.
134134

135135
[Read more!](docs/list.md)
136136

137+
#### Markdown
138+
139+
You can render text as markdown.
140+
141+
<img src="./docs/images/markdown-row.png" height="250" />
142+
143+
[Read more!](docs/markdown.md)
144+
137145
### Inputs
138146

139147
#### Select2 Input

docs/images/markdown-row.png

73.6 KB
Loading

docs/markdown.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Markdown
2+
3+
## Markdown Column
4+
5+
Renders text as markdown in the index view.
6+
7+
You just need to use `markdown_column` method.
8+
9+
```ruby
10+
index do
11+
markdown_column :description
12+
end
13+
```
14+
15+
## Markdown Row
16+
17+
Renders text as markdown in the show view.
18+
19+
You just need to use `markdown_row` method.
20+
21+
```ruby
22+
show do
23+
attributes_table do
24+
markdown_row :description
25+
end
26+
end
27+
```
28+
29+
## Options
30+
31+
This builder uses [Redcarpet](https://github.com/vmg/redcarpet) to render the text. You can pass any Redcarpet options to it. Using the options `extensions` and `render_options` to modify existing [Redcarpet options](https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use).
32+
33+
```ruby
34+
index do
35+
markdown_column :description, extensions: { footnotes: true }
36+
end
37+
38+
index do
39+
markdown_column :description, render_options: { hard_wrap: true }
40+
end
41+
```
42+
43+
### Builder default options
44+
45+
The builder enables the following options by default to provide a plug-and-play experience:
46+
47+
#### Extensions
48+
``` json
49+
fenced_code_blocks: true
50+
no_intra_emphasis: true
51+
strikethrough: true
52+
superscript: true
53+
```
54+
55+
#### Render options
56+
57+
```json
58+
filter_html: true,
59+
hard_wrap: true
60+
```

0 commit comments

Comments
 (0)