File tree 6 files changed +22
-8
lines changed 6 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ additional-css = ["custom.css", "custom2.css"]
104
104
additional-js = [" custom.js" ]
105
105
no-section-label = false
106
106
git-repository-url = " https://github.com/rust-lang/mdBook"
107
- git-repository-icon = " fa -github"
107
+ git-repository-icon = " fab -github"
108
108
edit-url-template = " https://github.com/rust-lang/mdBook/edit/master/guide/{path}"
109
109
site-url = " /example-book/"
110
110
cname = " myproject.rs"
@@ -142,7 +142,7 @@ The following configuration options are available:
142
142
- ** git-repository-url:** A url to the git repository for the book. If provided
143
143
an icon link will be output in the menu bar of the book.
144
144
- ** git-repository-icon:** The FontAwesome icon class to use for the git
145
- repository link. Defaults to ` fa -github` which looks like <i class =" fa fa -github " ></i >.
145
+ repository link. Defaults to ` fab -github` which looks like <i class =" fa fab -github " ></i >.
146
146
If you are not using GitHub, another option to consider is ` fa-code-fork ` which looks like <i class =" fa fa-code-fork " ></i >.
147
147
- ** edit-url-template:** Edit url template, when provided shows a
148
148
"Suggest an edit" button (which looks like <i class =" fa fa-edit " ></i >) for directly jumping to editing the currently
Original file line number Diff line number Diff line change @@ -278,9 +278,9 @@ contents (sidebar) by including a `\{{#title ...}}` near the top of the page.
278
278
## Font-Awesome icons
279
279
280
280
mdBook includes a copy of [ Font Awesome Free's] ( https://fontawesome.com )
281
- MIT-licensed SVG files. It emulates the ` <i class="fa" > ` syntax, but converts
282
- the results to inline SVG. Only the regular, solid, and brands icons are
283
- included; paid features like the light icons are not.
281
+ MIT-licensed SVG files. It emulates the ` <i> ` syntax, but converts the results
282
+ to inline SVG. Only the regular, solid, and brands icons are included; paid
283
+ features like the light icons are not.
284
284
285
285
For example, given this HTML syntax:
286
286
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ They are used like this
87
87
``` handlebars
88
88
{{#previous}}
89
89
<a href="{{link}}" class="nav-chapters previous">
90
- <i class="fa fa- angle-left"></i>
90
+ {{fa "solid" " angle-left"}}
91
91
</a>
92
92
{{/previous}}
93
93
```
Original file line number Diff line number Diff line change @@ -681,9 +681,19 @@ fn make_data(
681
681
682
682
let git_repository_icon = match html_config. git_repository_icon {
683
683
Some ( ref git_repository_icon) => git_repository_icon,
684
- None => "fa-github" ,
684
+ None => "fab-github" ,
685
+ } ;
686
+ let git_repository_icon_class = match git_repository_icon. split ( '-' ) . next ( ) {
687
+ Some ( "fa" ) => "regular" ,
688
+ Some ( "fas" ) => "solid" ,
689
+ Some ( "fab" ) => "brands" ,
690
+ _ => "regular" ,
685
691
} ;
686
692
data. insert ( "git_repository_icon" . to_owned ( ) , json ! ( git_repository_icon) ) ;
693
+ data. insert (
694
+ "git_repository_icon_class" . to_owned ( ) ,
695
+ json ! ( git_repository_icon_class) ,
696
+ ) ;
687
697
688
698
let mut chapters = vec ! [ ] ;
689
699
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ pub fn fa_helper(
27
27
28
28
let name = if name. starts_with ( "fa-" ) {
29
29
& name[ 3 ..]
30
+ } else if name. starts_with ( "fab-" ) {
31
+ & name[ 4 ..]
32
+ } else if name. starts_with ( "fas-" ) {
33
+ & name[ 4 ..]
30
34
} else {
31
35
& name[ ..]
32
36
} ;
Original file line number Diff line number Diff line change 144
144
{{ /if }}
145
145
{{ #if git_repository_url }}
146
146
<a href =" {{ git_repository_url }} " title =" Git repository" aria-label =" Git repository" >
147
- {{ fa " solid " git_repository_icon }}
147
+ {{ fa git_repository_icon_class git_repository_icon }}
148
148
</a >
149
149
{{ /if }}
150
150
{{ #if git_repository_edit_url }}
You can’t perform that action at this time.
0 commit comments