Skip to content

Commit a45b42d

Browse files
admonitions with icons and FontAwesome (#3254)
* admonitions with icons and FontAwesome Signed-off-by: Victoria Bialas <victoria.bialas@docker.com> * updated important and warning icons per review Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
1 parent efbea09 commit a45b42d

File tree

2 files changed

+50
-128
lines changed

2 files changed

+50
-128
lines changed

_scss/_notes.scss

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,79 @@
11
/*
2-
* Infos, notes, and warnings
2+
* note, important, and important admonition styles
33
*/
44

5-
$info-color: #1488C6;
6-
$warning-color: #aa6708;
7-
$danger-color: #ce4844;
5+
$note-color: #1488C6;
6+
$important-color: #aa6708;
7+
$warning-color: #ce4844;
88

99
blockquote {
10-
border-left-color: $info-color;
10+
border-left-color: $note-color;
1111
}
1212

1313
blockquote > p:first-child {
1414
margin-top: 0;
1515
font-weight: 700;
16-
color: $info-color;
16+
color: $note-color;
1717
}
1818

1919
blockquote > p:first-child::before {
2020
content: 'Note: ';
2121
}
2222

2323
blockquote.note-vanilla > p:first-child::before {
24-
content: '';
24+
content: '\f058 \00a0';
25+
font-family: FontAwesome;
2526
}
2627

27-
blockquote.warning {
28-
border-left-color: $warning-color;
28+
blockquote.important {
29+
border-left-color: $important-color;
2930
}
3031

31-
blockquote.warning > p:first-child {
32-
color: $warning-color;
32+
blockquote.important > p:first-child {
33+
color: $important-color;
3334
}
3435

35-
blockquote.warning > p:first-child::before {
36+
blockquote.important > p:first-child::before {
3637
content: 'Important: ';
3738
}
3839

39-
blockquote.warning-vanilla {
40-
border-left-color: $warning-color;
40+
blockquote.important-vanilla {
41+
border-left-color: $important-color;
4142
}
4243

43-
blockquote.warning-vanilla > p:first-child {
44-
color: $warning-color;
44+
blockquote.important-vanilla > p:first-child {
45+
color: $important-color;
4546
}
4647

47-
blockquote.warning-vanilla > p:first-child::before {
48-
content: '';
48+
blockquote.important-vanilla > p:first-child::before {
49+
content: '\f06a \00a0';
50+
font-family: FontAwesome;
4951
}
5052

51-
blockquote.danger {
52-
border-left-color: $danger-color;
53+
blockquote.warning {
54+
border-left-color: $warning-color;
5355
}
5456

55-
blockquote.danger > p:first-child {
56-
color: $danger-color;
57+
blockquote.warning > p:first-child {
58+
color: $warning-color;
5759
}
5860

59-
blockquote.danger > p:first-child::before {
60-
content: 'Warning: '
61+
blockquote.warning > p:first-child::before {
62+
content: 'Warning: ';
6163
}
6264

63-
blockquote.danger-vanilla {
64-
border-left-color: $danger-color;
65+
blockquote.warning-vanilla {
66+
border-left-color: $warning-color;
6567
}
6668

67-
blockquote.danger-vanilla > p:first-child {
68-
color: $danger-color;
69+
blockquote.warning-vanilla > p:first-child {
70+
color: $warning-color;
6971
}
7072

71-
blockquote.danger-vanilla > p:first-child::before {
72-
content: ''
73+
blockquote.warning-vanilla > p:first-child::before {
74+
content: '\f057 \00a0';
75+
font-family: FontAwesome;
76+
7377
}
7478

7579
/* Maintain backwards compatibility with old

test.md

Lines changed: 16 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,15 @@ The new styles (with icons) are defined a way that will not impact notes
372372
previously formatted with the original styles (prefixed text), so notes in your
373373
published documents won't be adversely affected.
374374
375-
Both styles are desribed below with examples.
375+
Examples of both styles are shown below.
376376
377377
### Examples (original styles, prefix words)
378378
379379
Admonitions with prefixed text use the following class tags, as shown in the examples.
380380
381381
* **Note:** No class tag is needed for standard notes.
382-
* **Important:** Use the `warning` class.
383-
* **Warning:** Use the `danger` class.
382+
* **Important:** Use the `important` class.
383+
* **Warning:** Use the `warning` class.
384384
385385
386386
> **Note**: This is a note using the old note style
@@ -394,18 +394,18 @@ Admonitions with prefixed text use the following class tags, as shown in the exa
394394
395395
> It's not safe out there, take this Moby with you
396396
>
397-
> Add the `warning` class to your blockquotes if you want to tell users
397+
> Add the `important` class to your blockquotes if you want to tell users
398398
to be careful about something.
399-
{: .warning}
399+
{: .important}
400400

401401
> Ouch, don't do that!
402402
>
403-
> Use the `danger` class to let people know this is dangerous or they
403+
> Use the `warning` class to let people know this is dangerous or they
404404
should pay close attention to this part of the road.
405405
>
406406
> You can also add more paragraphs here if your explanation is
407407
super complex.
408-
{: .danger}
408+
{: .warning}
409409
410410
>**This is a crazy note**
411411
>
@@ -421,110 +421,28 @@ Admonitions with prefixed text use the following class tags, as shown in the exa
421421
>
422422
> And another sentence to top it all off.
423423
424-
### Admonitions with Glyphicons
425-
426-
Let's experiment with some cute [Bootstrap
427-
Glypicons](http://getbootstrap.com/components/) instead of prefixed text labels. Three new classes have been added to [`_scss/notes.scss`](https://github.com/docker/docker.github.io/blob/master/_scss/_notes.scss):
428-
429-
<span><i class="glyphicon glyphicon-ok-sign"></i> Note text can go here.</span> (Notes use the `note-vanilla` class tag.)
430-
431-
<span><i class="glyphicon glyphicon-exclamation-sign"></i> Text that describes **Important** admonitions can go here.</span> (Important admonitions use the `warning-vanilla`.)
432-
433-
<span><i class="glyphicon glyphicon-ban-circle"></i> Text that describes a **Warning** situation can go here.</span> (Warning admonitions use the `danger-vanilla`.)
434-
435-
The associated pseudo-class definitions for `p:first-child::before` for the new classes all use a null value in `content`, instead of a prefixed word. For example, the standard `warning` class to denote something "Important" uses this:
436-
437-
```none
438-
blockquote.warning > p:first-child::before {
439-
content: 'Important: ';
440-
}
441-
```
442-
443-
whereas, `warning-vanilla` uses this:
444-
445-
```none
446-
blockquote.warning > p:first-child::before {
447-
content: '';
448-
}
449-
```
450-
451-
So far so good!
452-
453-
### Overhead of using Glyphicons
454-
455-
The problem is there doesn't seem to be a way to call the icons from the CSS.
456-
You need to add the HTML to call icons directly in the markdown. Examples shown
457-
below use inline HTML to call the appropriate glypicon for the admonition type,
458-
with this pattern: `<i class="glyphicon GlypiconName"></i> `.
459-
460-
|CSS class | Icon name |
461-
|--------------------|----------------------------------|
462-
| `note-vanilla` | `glyphicon-ok-sign` |
463-
| `warning-vanilla` | `glyphicon-exclamation-sign` |
464-
| `danger-vanilla` | `glyphicon glyphicon-ban-circle` |
465-
424+
### Examples with FontAwesome
466425
467-
Until we find a way to call the icons directly from the CSS, this approach will
468-
work, but there is a little more manual overhead involved with adding in the
469-
HTML prefix to each admonition in the markdown. Check out the raw
470-
[`test.md`](https://github.com/docker/docker.github.io/blob/master/test.md)
471-
file.
472-
473-
If we figure out how to call the icons from the CSS, we can replace the null value for `content` in `p:first-child::before` with that call.
474-
475-
### Examples with Glypicons
476-
477-
> <i class="glyphicon glyphicon-ok-sign"></i> Pssst, wanna know something?
426+
> Pssst, wanna know something?
478427
>
479428
> You include a small description here telling users to be on the lookout
480429
>
481-
> This is an example of a note using the `note-vanilla` tag, which gives you an icon instead of stock prefixed text so that you can write your own title.
430+
> This is an example of a note using the `{: .note-vanilla}` tag to get an icon instead of a "Note" prefix, and write your own note title.
482431
{: .note-vanilla}
483432
484-
> <i class="glyphicon glyphicon-ok-sign"></i> Glyphicon terms of use
485-
>
486-
> If we do implement the Glyphicons, we just need to include a link back to [Glyphicons](http://glyphicons.com/) per the use agreement.
487-
>
488-
> This is another example of a `note-vanilla` tag.
489-
{: .note-vanilla}
490433
491-
><i class="glyphicon glyphicon-exclamation-sign"></i> It's not safe out there, take this Moby with you
492-
>
493-
> Use the `warning-vanilla` class to get an icon and spice it up yourself with a custom title. Prefix the warning in markdown with `<i class="glyphicon glyphicon-exclamation-sign"></i> ` to get the warning icon.
494-
{: .warning-vanilla}
495-
496-
><i class="glyphicon glyphicon-exclamation-sign"></i> Leave a space before your custom text
434+
> It's not safe out there, take this Moby with you
497435
>
498-
> With all Glyphicons style notes, make sure the icon isn't smashed up against your custom text. Be sure to leave a space _after_ the `</i>` and _before_ the closing backtick: `<i class="glyphicon GlypiconName"></i> `
499-
{: .warning-vanilla}
436+
> Use `{: .important-vanilla}` after your important to get an "important" icon.
437+
{: .important-vanilla}
500438

501-
><i class="glyphicon glyphicon-ban-circle"></i> Ouch, don't touch that hot Docker engine!
439+
> Ouch, don't touch that hot Docker engine!
502440
>
503-
> Use the `danger-vanilla` class to get an icon and spice it up yourself with a custom title. Prefix the warning in markdown with `<i class="glyphicon glyphicon-ban-circle"></i> ` to get the danger icon.
441+
> Use `{: .warning-vanilla}` after your warning to get an icon instead of a "Warning" prefix.
504442
>
505443
> You can also add more paragraphs here if your explanation is
506444
super complex.
507-
{: .danger-vanilla}
508-
509-
### Test Liquid admonitions
510-
511-
We are experimenting with a different solution that uses Liquid variables. The following note makes a call to file `content/admonitions/notes.html`, where the Liquid variables are defined to format admonitions. We haven't gotten this totally working yet, and are assessing whether it's a more elegant solution or not.
512-
513-
{% include content/admonitions/notes.html type="warning" title="Do not do this" text="Multiline text is okay!
514-
515-
* See?
516-
* It's fine!" %}
517-
518-
## Comments
519-
520-
You can use XML style comments, which show up in the HTML "view source", or
521-
Liquid ones, which don't. You'll need to view the source of this file to see
522-
both styles.
523-
524-
<!-- This comment will show up in the HTML source -->
525-
526-
{% comment %}This one won't.{% endcomment %}
527-
445+
{: .warning-vanilla}
528446
529447
## Code blocks
530448

0 commit comments

Comments
 (0)