Skip to content

Commit 993c31c

Browse files
wbambergRyuno-Ki
andauthored
Specify Markdown note syntax (#4352)
* Add a section on notes and warnings * Update files/en-us/mdn/contribute/markdown_in_mdn/index.html Co-authored-by: André Jaenisch <[email protected]> * Update files/en-us/mdn/contribute/markdown_in_mdn/index.html Co-authored-by: André Jaenisch <[email protected]> * Update files/en-us/mdn/contribute/markdown_in_mdn/index.html Co-authored-by: André Jaenisch <[email protected]> * Update files/en-us/mdn/contribute/markdown_in_mdn/index.html Co-authored-by: André Jaenisch <[email protected]> * Update files/en-us/mdn/contribute/markdown_in_mdn/index.html Co-authored-by: André Jaenisch <[email protected]> * Update files/en-us/mdn/contribute/markdown_in_mdn/index.html Co-authored-by: André Jaenisch <[email protected]> * Update note syntax description Co-authored-by: Will <> Co-authored-by: André Jaenisch <[email protected]>
1 parent 0009f18 commit 993c31c

File tree

1 file changed

+144
-1
lines changed
  • files/en-us/mdn/contribute/markdown_in_mdn

1 file changed

+144
-1
lines changed

files/en-us/mdn/contribute/markdown_in_mdn/index.html

+144-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,150 @@ <h3>Example code blocks</h3>
113113
```
114114
</pre>
115115

116-
<h3>Notes and warnings</h3>
116+
<h3>Notes, warnings, and callouts</h3>
117+
118+
<p>Sometimes writers want to call special attention to some piece of content. To do this, they will use a GFM blockquote with a special first paragraph. There are three types of these: notes, warnings, and callouts.</p>
119+
120+
<ul>
121+
<li>To add a note, create a GFM blockquote whose first paragraph starts with <code>**Note:**</code>.</li>
122+
<li>To add a warning, create a GFM blockquote whose first paragraph starts with <code>**Warning:**</code>.</li>
123+
<li>To add a callout, create a GFM blockquote whose first paragraph starts with <code>**Callout:**</code>.</li>
124+
</ul>
125+
126+
<p>Notes and warnings will render the <strong>Note:</strong> or <strong>Warning:</strong> text in the output, while callouts will not. This makes callouts a good choice when an author wants to provide a custom title.</p>
127+
128+
<p>Processing of the markup works on the AST it produces, not on the exact characters provided. This means that providing <code>&lt;strong&gt;Note:&lt;/strong&gt;</code> will also generate a note. However, the Markdown syntax is required as a matter of style.</p>
129+
130+
<p>Multiple lines are produced by an empty block quote line in the same way as normal paragraphs. Further, multiple lines without a space are also treated like normal markdown lines, and concatenated.</p>
131+
132+
<p>The blockquote can contain code blocks or other block elements.</p>
133+
134+
<p>Because the text "Note:" or "Warning:" also appears in the rendered output, it has to be sensitive to translations. In practice this means that every locale supported by MDN must supply its own translation of these strings, and the platform must recognize them as indicating that the construct needs special treatment.</p>
135+
136+
<h4>Examples</h4>
137+
138+
<h5>Note</h5>
139+
140+
<pre>
141+
&gt; **Note:** This is how you write a note.
142+
&gt;
143+
&gt; It can have multiple lines.
144+
</pre>
145+
146+
<p>This will produce the following HTML:</p>
147+
148+
<pre class="brush: html">
149+
&lt;div class="notecard note"&gt;
150+
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is how you write a note.&lt;/p&gt;
151+
&lt;p&gt;It can have multiple lines.&lt;/p&gt;
152+
&lt;/div&gt;
153+
</pre>
154+
155+
<p>This HTML will be rendered as a highlighted box, like:</p>
156+
157+
<div class="notecard note">
158+
<p><strong>Note:</strong> This is how you write a note.</p>
159+
<p>It can have multiple lines.</p>
160+
</div>
161+
162+
<h5>Warnings</h5>
163+
164+
<pre>
165+
&gt; **Warning: This is how you write a warning.
166+
&gt;
167+
&gt; It can have multiple paragraphs.
168+
</pre>
169+
170+
<p>This will produce the following HTML:</p>
171+
172+
<pre class="brush: html">
173+
&lt;div class="notecard warning"&gt;
174+
&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; This is how you write a warning.&lt;/p&gt;
175+
&lt;p&gt;It can have multiple paragraphs.&lt;/p&gt;
176+
&lt;/div&gt;
177+
</pre>
178+
179+
<p>This HTML will be rendered as a highlighted box, like:</p>
180+
181+
<div class="notecard warning">
182+
<p><strong>Warning:</strong> This is how you write a warning.</p>
183+
<p>It can have multiple paragraphs.</p>
184+
</div>
185+
186+
<h5>Callouts</h5>
187+
188+
<pre>
189+
&gt; **Callout:** **This is how you write a callout**.
190+
&gt;
191+
&gt; It can have multiple paragaphs.
192+
</pre>
193+
194+
<p>This will produce the following HTML:</p>
195+
196+
<pre class="brush: html">
197+
&lt;div class="callout"&gt;
198+
&lt;p&gt;&lt;strong&gt;This is how you write a callout.&lt;/strong&gt;&lt;/p&gt;
199+
&lt;p&gt;It can have multiple paragraphs.&lt;/p&gt;
200+
&lt;/div&gt;
201+
</pre>
202+
203+
<p>This HTML will be rendered as a highlighted box, like:</p>
204+
205+
<div class="callout">
206+
<p><strong>This is how you write a callout.</strong></p>
207+
<p>It can have multiple paragraphs.</p>
208+
</div>
209+
210+
<h5>Translated warning</h5>
211+
212+
<p>For example, if we want to use "Warnung" for "Warning" in German, then in German pages we would write:</p>
213+
214+
<pre>
215+
&gt; Warnung: So schreibt man eine Warnung.
216+
</pre>
217+
218+
<p>...and this will produce:</p>
219+
220+
<pre class="brush: html">
221+
&lt;div class="notecard warning"&gt;
222+
&lt;p&gt;&lt;strong&gt;Warnung:&lt;/strong&gt; So schreibt man eine Warnung.&lt;/p&gt;
223+
&lt;/div&gt;
224+
</pre>
225+
226+
<h5>Note containing a code block</h5>
227+
228+
<p>This example contains a code block.</p>
229+
230+
<pre>
231+
&gt; **Note:** This is how you write a note.
232+
&gt;
233+
&gt; It can contain code blocks.
234+
&gt;
235+
&gt; ```js
236+
&gt; const s = "I'm in a code block";
237+
&gt; ```
238+
&gt; Like that.
239+
</pre>
240+
241+
<p>This will produce the following HTML:</p>
242+
243+
<pre class="brush: html">
244+
&lt;div class="notecard note"&gt;
245+
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is how you write a note.&lt;/p&gt;
246+
&lt;p&gt;It can contain code blocks.&lt;/p&gt;
247+
&lt;pre class="brush: js"&gt;const s = "I'm in a code block";&lt;/pre&gt;
248+
&lt;p&gt;Like that.&lt;/p&gt;
249+
&lt;/div&gt;
250+
</pre>
251+
252+
<p>This HTML will be rendered as with a code block, like:</p>
253+
254+
<div class="notecard note">
255+
<p><strong>Note:</strong> This is how you write a note.</p>
256+
<p>It can contain code blocks.</p>
257+
<pre class="brush: js">const s = "I'm in a code block";</pre>
258+
<p>Like that.</p>
259+
</div>
117260

118261
<h3>Definition lists</h3>
119262

0 commit comments

Comments
 (0)