Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<div class="flex flex-col gap-6 p-8 max-w-2xl">
<div data-controller="midwest-prose" class="midwest-prose prose midwest-markdown">
<h1>
<a href="#code-examples" aria-hidden="true" class="anchor" id="code-examples"></a>Code Examples</h1>
<p>Use <code>inline code</code> for short references.</p>
<h2>
<a href="#fenced-code-blocks" aria-hidden="true" class="anchor" id="fenced-code-blocks"></a>Fenced Code Blocks</h2>
<article data-controller="midwest-card midwest-code-block" class="midwest-card padding-none midwest-code-block theme-rouge">
<div class="wrap">
<header class="flex px-4">
<span class="midwest-tooltip" data-controller="midwest-tooltip">
<span id="tooltip-trigger-11890" class="midwest-tooltip-trigger" style="anchor-name: --tooltip-11890" data-action="mouseenter->midwest-tooltip#show mouseleave->midwest-tooltip#hide focus->midwest-tooltip#show blur->midwest-tooltip#hide" aria-describedby="tooltip-11890">
<button aria-label="Copy code" data-action="midwest-code-block#copy" class="midwest-button variant-ghost size-small theme-primary code-block-copy" name="button">
<span class="midwest-button-content">
<span class="copy-icon">
<div class="midwest-icon " aria-hidden="true">
<div class="midwest-icon-inner">
<svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" aria-hidden="true"><path d="M368 48h-11.41a8 8 0 01-7.44-5.08A42.18 42.18 0 00309.87 16H202.13a42.18 42.18 0 00-39.28 26.92 8 8 0 01-7.44 5.08H144a64 64 0 00-64 64v320a64 64 0 0064 64h224a64 64 0 0064-64V112a64 64 0 00-64-64zm-48.13 64H192.13a16 16 0 010-32h127.74a16 16 0 010 32z"></path></svg>
</div>
</div>
</span>
<span class="check-icon">
<div class="midwest-icon " aria-hidden="true">
<div class="midwest-icon-inner">
<svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"></path></svg>
</div>
</div>
</span>
</span>
<div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none">
<div class="midwest-loading-icon-inner">
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true">
<circle cx="15" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="60" cy="15" r="9" fill-opacity="0.3">
<animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="105" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
</svg>
</div>
</div>
</button>
</span> <span id="tooltip-11890" popover="manual" role="tooltip" class="midwest-tooltip-popover placement-top" style="position-anchor: --tooltip-11890" data-midwest-tooltip-target="popover">
Copy code
</span></span></header>
<section>
<div class="code-block-body" data-midwest-code-block-target="source">
<pre class="highlight"><code>def fibonacci(n)
return n if n <= 1
fibonacci(n - 1) + fibonacci(n - 2)
end
</code></pre>
</div>
</section>
</div>
</article>
<h2>
<a href="#another-example" aria-hidden="true" class="anchor" id="another-example"></a>Another Example</h2>
<article data-controller="midwest-card midwest-code-block" class="midwest-card padding-none midwest-code-block theme-rouge">
<div class="wrap">
<header class="flex px-4">
<span class="midwest-tooltip" data-controller="midwest-tooltip">
<span id="tooltip-trigger-11898" class="midwest-tooltip-trigger" style="anchor-name: --tooltip-11898" data-action="mouseenter->midwest-tooltip#show mouseleave->midwest-tooltip#hide focus->midwest-tooltip#show blur->midwest-tooltip#hide" aria-describedby="tooltip-11898">
<button aria-label="Copy code" data-action="midwest-code-block#copy" class="midwest-button variant-ghost size-small theme-primary code-block-copy" name="button">
<span class="midwest-button-content">
<span class="copy-icon">
<div class="midwest-icon " aria-hidden="true">
<div class="midwest-icon-inner">
<svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" aria-hidden="true"><path d="M368 48h-11.41a8 8 0 01-7.44-5.08A42.18 42.18 0 00309.87 16H202.13a42.18 42.18 0 00-39.28 26.92 8 8 0 01-7.44 5.08H144a64 64 0 00-64 64v320a64 64 0 0064 64h224a64 64 0 0064-64V112a64 64 0 00-64-64zm-48.13 64H192.13a16 16 0 010-32h127.74a16 16 0 010 32z"></path></svg>
</div>
</div>
</span>
<span class="check-icon">
<div class="midwest-icon " aria-hidden="true">
<div class="midwest-icon-inner">
<svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"></path></svg>
</div>
</div>
</span>
</span>
<div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none">
<div class="midwest-loading-icon-inner">
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true">
<circle cx="15" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="60" cy="15" r="9" fill-opacity="0.3">
<animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="105" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
</svg>
</div>
</div>
</button>
</span> <span id="tooltip-11898" popover="manual" role="tooltip" class="midwest-tooltip-popover placement-top" style="position-anchor: --tooltip-11898" data-midwest-tooltip-target="popover">
Copy code
</span></span></header>
<section>
<div class="code-block-body" data-midwest-code-block-target="source">
<pre class="highlight"><code>const greet = (name) => {
console.log(`Hello, ${name}!`);
};
</code></pre>
</div>
</section>
</div>
</article>
<p>For syntax-highlighted code with copy buttons, line numbers, and themes,<br>
use the <code>CodeBlockComponent</code> instead.</p>
</div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<%
sample = <<~'MD'
# Code Examples
Use `inline code` for short references.
## Fenced Code Blocks
```
def fibonacci(n)
return n if n <= 1
fibonacci(n - 1) + fibonacci(n - 2)
end
```
## Another Example
```
const greet = (name) => {
console.log(`Hello, ${name}!`);
};
```
For syntax-highlighted code with copy buttons, line numbers, and themes,
use the `CodeBlockComponent` instead.
MD
%>
<div class="flex flex-col gap-6 p-8 max-w-2xl">
<%= render Midwest::MarkdownComponent.new(sample) %>
</div>

No assets to display.
Add a .js or .css file alongside the component to see it here.

Accessibility

Figma embed for Markdown/code

Annotate a preview to embed its Figma design here:

@figma "https://figma.com/..."