Skip to content

Commit

Permalink
Updated shared content
Browse files Browse the repository at this point in the history
  • Loading branch information
gsfbuildbot committed Jul 22, 2020
1 parent a0e248c commit 0e045b2
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

# Expression-level preferences
dotnet_style_object_initializer = false:suggestion
dotnet_style_collection_initializer = false:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
Expand Down
45 changes: 37 additions & 8 deletions docs/_includes/anchor_headings.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
{% capture headingsWorkspace %}
{% comment %}
Version 1.0.4
Copyright (c) 2018 Vladimir "allejo" Jimenez

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
{% endcomment %}
{% comment %}
Version 1.0.6
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 %}
{% include anchor_headings.html html=content anchorBody="#" %}

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
* anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`
* anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
the `%heading%` placeholder is available
* 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
Expand Down Expand Up @@ -43,11 +68,15 @@
{% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
{% assign headerLevel = nextChar | times: 1 %}

<!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's try to fix it -->
<!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's see if we need to fix it -->
{% if headerLevel == 0 %}
{% if nextChar != '<' and nextChar != '' %}
<!-- Split up the node based on closing angle brackets and get the first one. -->
{% assign firstChunk = node | split: '>' | first %}

<!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
{% unless firstChunk contains '<' %}
{% capture node %}<h{{ node }}{% endcapture %}
{% endif %}
{% endunless %}

{% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
{% continue %}
Expand Down Expand Up @@ -76,7 +105,7 @@
{% endif %}

{% if include.anchorAttrs %}
{% capture anchor %}{{ anchor }} {{ include.anchorAttrs }}{% endcapture %}
{% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', header }}{% endcapture %}
{% endif %}

{% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}
Expand All @@ -102,4 +131,4 @@
{% endcapture %}
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
{% endfor %}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
50 changes: 48 additions & 2 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,52 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<link rel="icon" href="{{ site.baseurl }}/img/favicon.ico" type="image/x-icon">
<style>
h1 {
margin-left: -20px;
padding-left: 10px;
}

h2 {
margin-left: -18px;
padding-left: 10px;
}

h3 {
margin-left: -16px;
padding-left: 10px;
}

h4 {
margin-left: -14px;
padding-left: 10px;
}

h5 {
margin-left: -12px;
padding-left: 10px;
}

h6 {
margin-left: -10px;
padding-left: 10px;
}

h1 .octicon, h2 .octicon, h3 .octicon, h4 .octicon, h5 .octicon, h6 .octicon {
visibility: hidden;
}

h1:hover .octicon, h2:hover .octicon, h3:hover .octicon, h4:hover .octicon, h5:hover .octicon, h6:hover .octicon {
visibility: visible;
}

.octicon {
fill: currentColor;
padding: 0;
margin-left: -16px;
vertical-align: middle;
}
</style>
</head>
<body>
<header class="page-header" role="banner">
Expand All @@ -40,7 +86,7 @@ <h2 class="project-tagline">{{ page.description | default: site.description | de
</header>

<main id="content" class="main-content" role="main">
{% include anchor_headings.html html=content %}
{% include anchor_headings.html html=content beforeHeading=true anchorBody="<svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>" %}

<footer class="site-footer">
{% if site.github.is_project_page %}
Expand All @@ -51,4 +97,4 @@ <h2 class="project-tagline">{{ page.description | default: site.description | de
</footer>
</main>
</body>
</html>
</html>

0 comments on commit 0e045b2

Please sign in to comment.