1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-28 01:10:58 +01:00

Added option to configure fonts in mkdocs.yml with fallbacks

This commit is contained in:
squidfunk 2016-02-16 13:10:33 +01:00
parent 9233074124
commit 863e1482dc
21 changed files with 165 additions and 120 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -37,9 +37,43 @@
{% set icon = icon | default('assets/images/favicon-e565ddfa3b.ico') %} {% set icon = icon | default('assets/images/favicon-e565ddfa3b.ico') %}
<link rel="shortcut icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}">
<link rel="icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}"> <link rel="icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,700"> <style>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu+Mono"> @font-face {
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-5ffbc5b035.css"> font-family: 'Icon';
src: url('{{ base_url }}/assets/fonts/icon.eot?52m981');
src: url('{{ base_url }}/assets/fonts/icon.eot?#iefix52m981')
format('embedded-opentype'),
url('{{ base_url }}/assets/fonts/icon.woff?52m981')
format('woff'),
url('{{ base_url }}/assets/fonts/icon.ttf?52m981')
format('truetype'),
url('{{ base_url }}/assets/fonts/icon.svg?52m981#icon')
format('svg');
font-weight: normal;
font-style: normal;
}
</style>
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-fdabd46b62.css">
{% if config.extra.font != 'none' %}
{% set text = 'Ubuntu' %}
{% if config.extra.font and config.extra.font.text %}
{% set text = config.extra.font.text %}
{% endif %}
{% set code = 'Ubuntu Mono' %}
{% if config.extra.font and config.extra.font.code %}
{% set code = config.extra.font.code %}
{% endif %}
{% set font = text + ':400,700|' + code | replace('+', ' ') %}
<link rel="stylesheet" href="//fonts.googleapis.com/css?family={{ font }}">
<style>
body, input {
font-family: '{{ text }}', Helvetica, Arial, sans-serif;
}
pre, code {
font-family: '{{ code }}', 'Courier New', 'Courier', monospace;
}
</style>
{% endif %}
{% for path in extra_css %} {% for path in extra_css %}
<link rel="stylesheet" href="{{ path }}"> <link rel="stylesheet" href="{{ path }}">
{% endfor %} {% endfor %}
@ -103,7 +137,7 @@
</div> </div>
</div> </div>
</main> </main>
<script src="{{ base_url }}/assets/javascripts/modernizr-e5e5f05404.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr-4ab42b99fd.js"></script>
<script> <script>
var base_url = '{{ base_url }}'; var base_url = '{{ base_url }}';
var repo_id = '{{ repo_id }}'; var repo_id = '{{ repo_id }}';

View File

@ -1,4 +1,4 @@
<nav aria-label="navigation"> <nav aria-label="Navigation">
<a href="{{ repo_url }}" class="project"> <a href="{{ repo_url }}" class="project">
<div class="banner"> <div class="banner">
{% if config.extra.logo %} {% if config.extra.logo %}
@ -21,12 +21,12 @@
<ul class="repo"> <ul class="repo">
<li class="repo-download"> <li class="repo-download">
{% set version = config.extra.version | default('master') %} {% set version = config.extra.version | default('master') %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" aria-label="Download {{ repo_id }} from GitHub"> <a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download {{ repo_id }} from GitHub" data-action="download">
<i class="icon icon-download"></i> Download <i class="icon icon-download"></i> Download
</a> </a>
</li> </li>
<li class="repo-stars"> <li class="repo-stars">
<a href="{{ repo_url }}" target="_blank" aria-label="Star {{ repo_id }} on GitHub"> <a href="{{ repo_url }}" target="_blank" title="Star {{ repo_id }} on GitHub" data-action="star">
<i class="icon icon-star"></i> Star <i class="icon icon-star"></i> Star
<span class="count">&ndash;</span> <span class="count">&ndash;</span>
</a> </a>
@ -44,16 +44,18 @@
<span class="section">The author</span> <span class="section">The author</span>
<ul> <ul>
{% if config.extra.author.twitter %} {% if config.extra.author.twitter %}
{% set author = config.extra.author.twitter %}
<li> <li>
<a href="https://twitter.com/{{ config.extra.author.twitter }}" title="@{{ config.extra.author.twitter }} on Twitter" target="_blank"> <a href="https://twitter.com/{{ author }}" target="_blank" title="@{{ author }} on Twitter">
@{{ config.extra.author.twitter }} on Twitter @{{ author }} on Twitter
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if config.extra.author.github %} {% if config.extra.author.github %}
{% set author = config.extra.author.github %}
<li> <li>
<a href="https://github.com/{{ config.extra.author.github }}" title="@{{ config.extra.author.twitter }} on GitHub" target="_blank"> <a href="https://github.com/{{ author }}" target="_blank" title="@{{ author }} on GitHub">
@{{ config.extra.author.github }} on GitHub @{{ author }} on GitHub
</a> </a>
</li> </li>
{% endif %} {% endif %}

View File

@ -1,5 +1,5 @@
{% if include_next_prev %} {% if include_next_prev %}
<nav class="pagination" aria-label="footer navigation"> <nav class="pagination" aria-label="Footer">
<div class="previous"> <div class="previous">
{% if previous_page %} {% if previous_page %}
<a href="{{ previous_page.url }}" title="{{ previous_page.title }}"> <a href="{{ previous_page.url }}" title="{{ previous_page.title }}">

View File

@ -1,4 +1,4 @@
<nav aria-label="top navigation"> <nav aria-label="Header">
<div class="bar default"> <div class="bar default">
<div class="button button-menu" role="button" aria-label="Menu"> <div class="button button-menu" role="button" aria-label="Menu">
<label class="toggle-button icon icon-menu" for="toggle-drawer"> <label class="toggle-button icon icon-menu" for="toggle-drawer">

View File

@ -1,6 +1,6 @@
{ {
"assets/images/favicon.ico": "assets/images/favicon-e565ddfa3b.ico", "assets/images/favicon.ico": "assets/images/favicon-e565ddfa3b.ico",
"assets/javascripts/application.js": "assets/javascripts/application-c6d2e828bd.js", "assets/javascripts/application.js": "assets/javascripts/application-c6d2e828bd.js",
"assets/javascripts/modernizr.js": "assets/javascripts/modernizr-e5e5f05404.js", "assets/javascripts/modernizr.js": "assets/javascripts/modernizr-4ab42b99fd.js",
"assets/stylesheets/application.css": "assets/stylesheets/application-5ffbc5b035.css" "assets/stylesheets/application.css": "assets/stylesheets/application-fdabd46b62.css"
} }

View File

@ -38,6 +38,9 @@ theme_dir: material
extra: extra:
version: 0.1.1 version: 0.1.1
logo: images/logo.png logo: images/logo.png
font:
text: Ubuntu
code: Ubuntu Mono
author: author:
github: squidfunk github: squidfunk
twitter: squidfunk twitter: squidfunk

View File

@ -24,13 +24,6 @@
* Code highlighter * Code highlighter
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/*
* Inline code
*/
code {
color: $primary;
}
/* /*
* Code block * Code block
*/ */
@ -69,7 +62,7 @@ pre {
/* /*
* Strings * Strings
*/ */
.s { .s, .s1 {
color: #183691; color: #183691;
} }

View File

@ -21,28 +21,22 @@
*/ */
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Font faces * Font faces - defined in base.html for correct path resolution
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/* // /*
* Base URL and path for icon font. // * Icon font
*/ // */
$base: '../..'; // @font-face {
$path: $base + '/assets/fonts/'; // font-family: 'Icon';
// src: url('/assets/fonts/icon.eot?52m981');
/* // src: url('/assets/fonts/icon.eot?#iefix52m981') format('embedded-opentype'),
* Icon font // url('/assets/fonts/icon.woff?52m981') format('woff'),
*/ // url('/assets/fonts/icon.ttf?52m981') format('truetype'),
@font-face { // url('/assets/fonts/icon.svg?52m981#icon') format('svg');
font-family: 'Icon'; // font-weight: normal;
src: url($path + 'icon.eot?52m981'); // font-style: normal;
src: url($path + 'icon.eot?#iefix52m981') format('embedded-opentype'), // }
url($path + 'icon.woff?52m981') format('woff'),
url($path + 'icon.ttf?52m981') format('truetype'),
url($path + 'icon.svg?52m981#icon') format('svg');
font-weight: normal;
font-style: normal;
}
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Representational classes * Representational classes

View File

@ -44,9 +44,9 @@
} }
/* /*
* Headlines and chapters in primary color * Headlines, chapters, links and inline code
*/ */
h1, h2 { h1, h2, a, code {
color: $primary; color: $primary;
} }
@ -58,18 +58,18 @@
} }
/* /*
* Color links * Hovered and focused links
*/ */
a { a:hover,
color: $primary; a:focus {
color: $accent;
}
/* /*
* Hovered link * Light permalinks
*/ */
&:hover, .headerlink {
&:focus { color: $black-lighter;
color: $accent;
}
} }
/* /*
@ -134,10 +134,8 @@
/* /*
* Inherit color for links * Inherit color for links
*/ */
a, a .title, a .button {
a:hover, color: $white;
a:focus {
color: inherit;
} }
/* /*
@ -168,14 +166,3 @@
background: mix($red-500, $white, 10%); background: mix($red-500, $white, 10%);
} }
} }
/*
* Permalink support
*/
.article {
h2, h3, h4, h5, h6 {
a {
color: $black-lighter;
}
}
}

View File

@ -126,6 +126,22 @@
} }
} }
/*
* Align permalinks on the right
*/
.headerlink {
float: right;
margin-left: 20px;
font-size: 14px;
/*
* Hide permalink to main headline
*/
h1 & {
display: none;
}
}
/* /*
* Paragraphs and section titles * Paragraphs and section titles
*/ */
@ -515,26 +531,3 @@
padding: 20px 24px; padding: 20px 24px;
} }
} }
/*
* Permalink support
*/
.article {
/*
* Hide link to main headline
*/
h1 a {
display: none;
}
/*
* Align permalinks on the right
*/
h2, h3, h4, h5, h6 {
a {
float: right;
margin-left: 20px;
}
}
}

View File

@ -28,7 +28,7 @@
* Default font styles * Default font styles
*/ */
body, input { body, input {
font-family: 'Ubuntu', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 400; font-weight: 400;
/* Enable font-smoothing in Webkit and FF */ /* Enable font-smoothing in Webkit and FF */
@ -47,7 +47,7 @@ body, input {
* Proportional fonts * Proportional fonts
*/ */
pre, code { pre, code {
font-family: 'Ubuntu Mono', 'Courier New', 'Courier', monospace; font-family: 'Courier New', 'Courier', monospace;
/* /*
* Use system fonts, if browser doesn't support webfonts * Use system fonts, if browser doesn't support webfonts

View File

@ -64,15 +64,52 @@
<link rel="icon" type="image/x-icon" <link rel="icon" type="image/x-icon"
href="{{ base_url }}/{{ icon }}" /> href="{{ base_url }}/{{ icon }}" />
<!-- Webfonts --> <!-- Configure icons (placed here to omit issues with subdirectories) -->
<link rel="stylesheet" type="text/css" <style>
href="https://fonts.googleapis.com/css?family=Ubuntu:400,700" /> @font-face {
<link rel="stylesheet" type="text/css" font-family: 'Icon';
href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" /> src: url('{{ base_url }}/assets/fonts/icon.eot?52m981');
src: url('{{ base_url }}/assets/fonts/icon.eot?#iefix52m981')
format('embedded-opentype'),
url('{{ base_url }}/assets/fonts/icon.woff?52m981')
format('woff'),
url('{{ base_url }}/assets/fonts/icon.ttf?52m981')
format('truetype'),
url('{{ base_url }}/assets/fonts/icon.svg?52m981#icon')
format('svg');
font-weight: normal;
font-style: normal;
}
</style>
<!-- Theme-related and custom stylesheets --> <!-- Theme-related stylesheets -->
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="{{ base_url }}/assets/stylesheets/application.css" /> href="{{ base_url }}/assets/stylesheets/application.css" />
<!-- Configure webfonts -->
{% if config.extra.font != 'none' %}
{% set text = 'Ubuntu' %}
{% if config.extra.font and config.extra.font.text %}
{% set text = config.extra.font.text %}
{% endif %}
{% set code = 'Ubuntu Mono' %}
{% if config.extra.font and config.extra.font.code %}
{% set code = config.extra.font.code %}
{% endif %}
{% set font = text + ':400,700|' + code | replace('+', ' ') %}
<link rel="stylesheet" type="text/css"
href="//fonts.googleapis.com/css?family={{ font }}" />
<style>
body, input {
font-family: '{{ text }}', Helvetica, Arial, sans-serif;
}
pre, code {
font-family: '{{ code }}', 'Courier New', 'Courier', monospace;
}
</style>
{% endif %}
<!-- Custom stylesheets -->
{% for path in extra_css %} {% for path in extra_css %}
<link rel="stylesheet" type="text/css" href="{{ path }}" /> <link rel="stylesheet" type="text/css" href="{{ path }}" />
{% endfor %} {% endfor %}

View File

@ -1,5 +1,5 @@
<!-- Navigation --> <!-- Navigation -->
<nav aria-label="navigation"> <nav aria-label="Navigation">
<!-- Project information --> <!-- Project information -->
<a href="{{ repo_url }}" class="project"> <a href="{{ repo_url }}" class="project">
@ -36,14 +36,16 @@
<ul class="repo"> <ul class="repo">
<li class="repo-download"> <li class="repo-download">
{% set version = config.extra.version | default('master') %} {% set version = config.extra.version | default('master') %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" <a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank"
target="_blank" aria-label="Download {{ repo_id }} from GitHub"> title="Download {{ repo_id }} from GitHub"
data-action="download">
<i class="icon icon-download"></i> Download <i class="icon icon-download"></i> Download
</a> </a>
</li> </li>
<li class="repo-stars"> <li class="repo-stars">
<a href="{{ repo_url }}" <a href="{{ repo_url }}" target="_blank"
target="_blank" aria-label="Star {{ repo_id }} on GitHub"> title="Star {{ repo_id }} on GitHub"
data-action="star">
<i class="icon icon-star"></i> Star <i class="icon icon-star"></i> Star
<span class="count">&ndash;</span> <span class="count">&ndash;</span>
</a> </a>
@ -67,22 +69,22 @@
<!-- Twitter --> <!-- Twitter -->
{% if config.extra.author.twitter %} {% if config.extra.author.twitter %}
{% set author = config.extra.author.twitter %}
<li> <li>
<a href="https://twitter.com/{{ config.extra.author.twitter }}" <a href="https://twitter.com/{{ author }}" target="_blank"
title="@{{ config.extra.author.twitter }} on Twitter" title="@{{ author }} on Twitter">
target="_blank"> @{{ author }} on Twitter
@{{ config.extra.author.twitter }} on Twitter
</a> </a>
</li> </li>
{% endif %} {% endif %}
<!-- GitHub --> <!-- GitHub -->
{% if config.extra.author.github %} {% if config.extra.author.github %}
{% set author = config.extra.author.github %}
<li> <li>
<a href="https://github.com/{{ config.extra.author.github }}" <a href="https://github.com/{{ author }}" target="_blank"
title="@{{ config.extra.author.twitter }} on GitHub" title="@{{ author }} on GitHub">
target="_blank"> @{{ author }} on GitHub
@{{ config.extra.author.github }} on GitHub
</a> </a>
</li> </li>
{% endif %} {% endif %}

View File

@ -1,6 +1,6 @@
<!-- Previous and next page --> <!-- Previous and next page -->
{% if include_next_prev %} {% if include_next_prev %}
<nav class="pagination" aria-label="footer navigation"> <nav class="pagination" aria-label="Footer">
<!-- Previous page --> <!-- Previous page -->
<div class="previous"> <div class="previous">

View File

@ -1,5 +1,5 @@
<!-- Top-level navigation --> <!-- Top-level navigation -->
<nav aria-label="top navigation"> <nav aria-label="Header">
<!-- Default bar --> <!-- Default bar -->
<div class="bar default"> <div class="bar default">