Skip to content

Commit

Permalink
Docs 8.0 (#2254)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Jan 21, 2019
1 parent c39ddec commit e9e33bb
Show file tree
Hide file tree
Showing 42 changed files with 1,356 additions and 344 deletions.
11 changes: 3 additions & 8 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ compress_html:
clippings: all
endings: all
include: ["_headers"]
highlighter: none
kramdown:
enable_coderay: false
coderay:
coderay_wrap: div
coderay_line_numbers: inline
coderay_line_number_start: 1
coderay_tab_width: 4
coderay_bold_every: 10
coderay_css: style
syntax_highlighter_opts:
disable : true
gems:

93 changes: 93 additions & 0 deletions docs/_includes/anchor_headings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{% capture headingsWorkspace %}
{% comment %}
Version 1.0.2
https://github.com/allejo/jekyll-anchor-headings

"Be the pull request you wish to see in the world." ~Ben Balter

Usage:
{% include anchor_headings.html html=content %}

Parameters:
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll

Optional Parameters:
* beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
* anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
* anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
* anchorTitle (string) : '' - The `title` attribute that will be used for anchors
* h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored
* h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored
* bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content
* bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content

Output:
The original HTML with the addition of anchors inside of all of the h1-h6 headings.
{% endcomment %}

{% assign minHeader = include.h_min | default: 1 %}
{% assign maxHeader = include.h_max | default: 6 %}
{% assign beforeHeading = include.beforeHeading %}
{% assign nodes = include.html | split: '<h' %}

{% capture edited_headings %}{% endcapture %}

{% for node in nodes %}
{% if node == "" %}
{% continue %}
{% endif %}

{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}

<!-- If the node doesn't have a header, then it's content before the first heading; don't discard it -->
{% if headerLevel < 1 or headerLevel > 6 %}
{% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
{% continue %}
{% endif %}

{% assign _workspace = node | split: '</h' %}
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
{% assign html_id = _idWorkspace[0] %}

{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}

<!-- Build the anchor to inject for our heading -->
{% capture anchor %}{% endcapture %}

{% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
{% capture anchor %}href="#{{ html_id}}"{% endcapture %}

{% if include.anchorClass %}
{% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
{% endif %}

{% if include.anchorTitle %}
{% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %}
{% endif %}

{% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}

<!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it -->
{% if beforeHeading %}
{% capture anchor %}{{ anchor }} {% endcapture %}
{% else %}
{% capture anchor %} {{ anchor }}{% endcapture %}
{% endif %}
{% endif %}

{% capture new_heading %}
<h{{ _hAttrToStrip }}
{{ include.bodyPrefix }}
{% if beforeHeading %}
{{ anchor }}{{ header }}
{% else %}
{{ header }}{{ anchor }}
{% endif %}
{{ include.bodySuffix }}
</h{{ _workspace | last }}
{% endcapture %}
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
{% endfor %}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
21 changes: 21 additions & 0 deletions docs/_includes/css/sitespeed.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,27 @@ a:hover {
cursor: pointer;
text-decoration: underline;
}



code {
font-size: 16px;
background-color: #f5f2f0;
}

pre code {
display: block;
padding: 6px;
}

/*
code {
background-color: #eee;
padding: 2px;
}
#
pre code {
display: block;
padding: 9.5px;
Expand All @@ -147,6 +162,7 @@ border-radius: 4px;
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
white-space: pre-wrap;
}
*/

.language-bash code:before {
content: '$ ';
Expand Down Expand Up @@ -323,6 +339,11 @@ blockquote span:before {
color: red;
}

.anchor {
font-size: 80%;
color: grey;
}

.king img:hover {
/* Start the shake animation and make the animation last for 0.5 seconds */
animation: shake 0.5s;
Expand Down
4 changes: 2 additions & 2 deletions docs/_includes/index/box6.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Browsertime 3.0
## Browsertime 4.0
* * *
[<img src="{{site.baseurl}}/img/browsertime-ff-chrome.png" class="pull-left img-big" alt="Browsertime logo" width="180" height="162">]({{site.baseurl}}/documentation/browsertime)

We've been working on releasing 3.0 of Browsertime for some time and now it's here! You should use Browsertime if you want a raw JSON result for timings and/or execute your own JavaScript. Browsertime is perfect if you wanna build your own performance tool, as VoxMedia did when they created [Lightbike](https://github.com/voxmedia/lightbike) built on top of Browsertime.
Browsertime 4.0 supports testing multiple pages within the same browser session and scriptinmg. You should use Browsertime if you want a raw JSON result for timings and/or execute your own JavaScript. Browsertime is perfect if you wanna build your own performance tool, as VoxMedia did when they created [Lightbike](https://github.com/voxmedia/lightbike) built on top of Browsertime.
2 changes: 1 addition & 1 deletion docs/_includes/index/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Use our [Docker container](https://hub.docker.com/r/sitespeedio/sitespeed.io/) to get an environment with Firefox, Chrome, XVFB and sitespeed.io up and running as fast as you can download them. They work [extremely well]({{site.baseurl}}/documentation/sitespeed.io/performance-dashboard/) together with Graphite/InfluxDB and Grafana.

~~~bash
docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} https://www.sitespeed.io/
docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} https://www.sitespeed.io/
~~~

#### npm
Expand Down
6 changes: 4 additions & 2 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
<link type="application/atom+xml" href="https://www.sitespeed.io/feed/index.xml" rel="alternate" />

<style>{% include css/default.css %}</style>
<link rel="stylesheet" href="{{ "/css/prism-1.15.css" | prepend: site.baseurl }}">
<script type="text/javascript">{% include userTimings.js %}</script>
{% include analythics.js %}
<script src="{{ "/js/clipboard-2.0.4.min.js" | prepend: site.baseurl }}" defer></script>
<script src="{{ "/js/prism-1.15.js" | prepend: site.baseurl }}" defer></script>
</head>

<body>
Expand All @@ -53,7 +55,7 @@
<div class="grid">
<div class="col-1-1">
<main>
{{ content }}
{% include anchor_headings.html html=content anchorBody='#' anchorClass='anchor' h_max=4 h_min=2 %}
</main>
</div>
<section>
Expand Down
3 changes: 3 additions & 0 deletions docs/_layouts/startpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<style>
{% include css/default.css %}
</style>
<link rel="stylesheet" href="{{ "/css/prism-1.15.css" | prepend: site.baseurl }}">
<script src="{{ "/js/clipboard-2.0.4.min.js" | prepend: site.baseurl }}" defer></script>
<script src="{{ "/js/prism-1.15.js" | prepend: site.baseurl }}" defer></script>
</head>

<body>
Expand Down
Loading

0 comments on commit e9e33bb

Please sign in to comment.