Skip to content

Commit 3e55a17

Browse files
committed
update quick help
with `gh_token_help()`
1 parent f6e566e commit 3e55a17

File tree

7 files changed

+151
-65
lines changed

7 files changed

+151
-65
lines changed

docs/index.html

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,17 @@
5050
}
5151
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
5252
div.sourceCode
53-
{ }
53+
{ color: #00769e; background-color: #f1f3f5; }
5454
@media screen {
5555
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
5656
}
57+
code span { color: #00769e; } /* Normal */
5758
code span.al { color: #ad0000; } /* Alert */
5859
code span.an { color: #5e5e5e; } /* Annotation */
59-
code span.at { } /* Attribute */
60+
code span.at { color: #657422; } /* Attribute */
6061
code span.bn { color: #ad0000; } /* BaseN */
6162
code span.bu { } /* BuiltIn */
62-
code span.cf { color: #007ba5; } /* ControlFlow */
63+
code span.cf { color: #00769e; } /* ControlFlow */
6364
code span.ch { color: #20794d; } /* Char */
6465
code span.cn { color: #8f5902; } /* Constant */
6566
code span.co { color: #5e5e5e; } /* Comment */
@@ -73,9 +74,9 @@
7374
code span.fu { color: #4758ab; } /* Function */
7475
code span.im { } /* Import */
7576
code span.in { color: #5e5e5e; } /* Information */
76-
code span.kw { color: #007ba5; } /* Keyword */
77+
code span.kw { color: #00769e; } /* Keyword */
7778
code span.op { color: #5e5e5e; } /* Operator */
78-
code span.ot { color: #007ba5; } /* Other */
79+
code span.ot { color: #00769e; } /* Other */
7980
code span.pp { color: #ad0000; } /* Preprocessor */
8081
code span.sc { color: #5e5e5e; } /* SpecialChar */
8182
code span.ss { color: #20794d; } /* SpecialString */
@@ -1033,10 +1034,6 @@ <h3>${suggestion.title}</h3>
10331034
margin-top: 1.5em;
10341035
}
10351036

1036-
.figure img {
1037-
width: 100%;
1038-
}
1039-
10401037
.figure .caption {
10411038
color: rgba(0, 0, 0, 0.6);
10421039
font-size: 12px;
@@ -1866,6 +1863,12 @@ <h3>${suggestion.title}</h3>
18661863

18671864
// hoverable references
18681865
$('span.citation[data-cites]').each(function() {
1866+
if ($(this).children()[0].nodeName == "D-FOOTNOTE") {
1867+
var fn = $(this).children()[0]
1868+
$(this).html(fn.shadowRoot.querySelector("sup"))
1869+
$(this).id = fn.id
1870+
fn.remove()
1871+
}
18691872
var refs = $(this).attr('data-cites').split(" ");
18701873
var refHtml = refs.map(function(ref) {
18711874
return "<p>" + $('#ref-' + ref).html() + "</p>";
@@ -1881,6 +1884,31 @@ <h3>${suggestion.title}</h3>
18811884
});
18821885
});
18831886

1887+
// fix footnotes in tables (#411)
1888+
// replacing broken distill.pub feature
1889+
$('table d-footnote').each(function() {
1890+
// we replace internal showAtNode methode which is triggered when hovering a footnote
1891+
this.hoverBox.showAtNode = function(node) {
1892+
// ported from https://github.com/distillpub/template/pull/105/files
1893+
calcOffset = function(elem) {
1894+
let x = elem.offsetLeft;
1895+
let y = elem.offsetTop;
1896+
// Traverse upwards until an `absolute` element is found or `elem`
1897+
// becomes null.
1898+
while (elem = elem.offsetParent && elem.style.position != 'absolute') {
1899+
x += elem.offsetLeft;
1900+
y += elem.offsetTop;
1901+
}
1902+
1903+
return { left: x, top: y };
1904+
}
1905+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop
1906+
const bbox = node.getBoundingClientRect();
1907+
const offset = calcOffset(node);
1908+
this.show([offset.left + bbox.width, offset.top + bbox.height]);
1909+
}
1910+
})
1911+
18841912
// clear polling timer
18851913
clearInterval(tid);
18861914

@@ -1979,6 +2007,8 @@ <h3>${suggestion.title}</h3>
19792007
// mark non-body figures created by knitr chunks as 100% width
19802008
$('.layout-chunk').each(function(i, val) {
19812009
var figures = $(this).find('img, .html-widget');
2010+
// ignore leaflet img layers (#106)
2011+
figures = figures.filter(':not(img[class*="leaflet"])')
19822012
if ($(this).attr('data-layout') !== "l-body") {
19832013
figures.css('width', '100%');
19842014
} else {
@@ -2001,7 +2031,7 @@ <h3>${suggestion.title}</h3>
20012031
// get rid of index.html references in header
20022032
if (window.location.protocol !== "file:") {
20032033
$('.distill-site-header a[href]').each(function(i,val) {
2004-
$(this).attr('href', $(this).attr('href').replace("index.html", "./"));
2034+
$(this).attr('href', $(this).attr('href').replace(/^index[.]html/, "./"));
20052035
});
20062036
}
20072037

@@ -2040,7 +2070,7 @@ <h3>${suggestion.title}</h3>
20402070
</script>
20412071

20422072
<!--/radix_placeholder_distill-->
2043-
<script src="site_libs/header-attrs-2.13/header-attrs.js"></script>
2073+
<script src="site_libs/header-attrs-2.16/header-attrs.js"></script>
20442074
<script src="site_libs/popper-2.6.0/popper.min.js"></script>
20452075
<link href="site_libs/tippy-6.2.7/tippy.css" rel="stylesheet" />
20462076
<link href="site_libs/tippy-6.2.7/tippy-light-border.css" rel="stylesheet" />
@@ -2130,48 +2160,44 @@ <h3 id="tips">Tips</h3>
21302160
<h4 id="clone-or-fork-from-github">Clone or fork from GitHub</h4>
21312161
<div class="layout-chunk" data-layout="l-body">
21322162
<div class="sourceCode">
2133-
<pre class="sourceCode r"><code class="sourceCode r"><span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/create_from_github.html'>create_from_github</a></span><span class='op'>(</span><span class='st'>"https://github.com/data-and-visualization/git-tutorial"</span><span class='op'>)</span>
2134-
</code></pre>
2163+
<pre class="sourceCode r"><code class="sourceCode r"><span><span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/create_from_github.html'>create_from_github</a></span><span class='op'>(</span><span class='st'>"https://github.com/data-and-visualization/git-tutorial"</span><span class='op'>)</span></span></code></pre>
21352164
</div>
21362165
</div>
21372166
<h4 id="create-the-github-repo-from-local">Create the GitHub repo from
21382167
local</h4>
21392168
<div class="layout-chunk" data-layout="l-body">
21402169
<div class="sourceCode">
2141-
<pre class="sourceCode r"><code class="sourceCode r"><span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://usethis.r-lib.org'>usethis</a></span><span class='op'>)</span>
2142-
<span class='fu'><a href='https://usethis.r-lib.org/reference/use_git.html'>use_git</a></span><span class='op'>(</span><span class='op'>)</span> <span class='co'># initialize a git repo</span>
2143-
<span class='fu'><a href='https://usethis.r-lib.org/reference/use_git_ignore.html'>use_git_ignore</a></span><span class='op'>(</span><span class='op'>)</span>
2144-
<span class='fu'>use_readme.Rmd</span><span class='op'>(</span><span class='op'>)</span>
2145-
<span class='fu'><a href='https://usethis.r-lib.org/reference/licenses.html'>use_ccby_license</a></span><span class='op'>(</span><span class='op'>)</span>
2146-
<span class='co'># Before next step → stage &amp; commit changes</span>
2147-
<span class='fu'><a href='https://usethis.r-lib.org/reference/use_github.html'>use_github</a></span><span class='op'>(</span><span class='op'>)</span> <span class='co'># Connect local repo to GitHub</span>
2148-
</code></pre>
2170+
<pre class="sourceCode r"><code class="sourceCode r"><span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://usethis.r-lib.org'>usethis</a></span><span class='op'>)</span></span>
2171+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/use_git.html'>use_git</a></span><span class='op'>(</span><span class='op'>)</span> <span class='co'># initialize a git repo</span></span>
2172+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/use_git_ignore.html'>use_git_ignore</a></span><span class='op'>(</span><span class='op'>)</span></span>
2173+
<span><span class='fu'>use_readme.Rmd</span><span class='op'>(</span><span class='op'>)</span></span>
2174+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/licenses.html'>use_ccby_license</a></span><span class='op'>(</span><span class='op'>)</span></span>
2175+
<span><span class='co'># Before next step → stage &amp; commit changes</span></span>
2176+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/use_github.html'>use_github</a></span><span class='op'>(</span><span class='op'>)</span> <span class='co'># Connect local repo to GitHub</span></span></code></pre>
21492177
</div>
21502178
</div>
21512179
<h4 id="rename-default-branch">Rename default branch</h4>
21522180
<div class="layout-chunk" data-layout="l-body">
21532181
<div class="sourceCode">
2154-
<pre class="sourceCode r"><code class="sourceCode r"><span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://usethis.r-lib.org'>usethis</a></span><span class='op'>)</span>
2155-
<span class='fu'><a href='https://usethis.r-lib.org/reference/git-default-branch.html'>git_default_branch</a></span><span class='op'>(</span><span class='op'>)</span>
2156-
<span class='fu'><a href='https://usethis.r-lib.org/reference/git-default-branch.html'>git_default_branch_rename</a></span><span class='op'>(</span><span class='op'>)</span>
2157-
<span class='fu'><a href='https://usethis.r-lib.org/reference/git-default-branch.html'>git_default_branch_rediscover</a></span><span class='op'>(</span><span class='op'>)</span>
2158-
</code></pre>
2182+
<pre class="sourceCode r"><code class="sourceCode r"><span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://usethis.r-lib.org'>usethis</a></span><span class='op'>)</span></span>
2183+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/git-default-branch.html'>git_default_branch</a></span><span class='op'>(</span><span class='op'>)</span></span>
2184+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/git-default-branch.html'>git_default_branch_rename</a></span><span class='op'>(</span><span class='op'>)</span></span>
2185+
<span><span class='fu'><a href='https://usethis.r-lib.org/reference/git-default-branch.html'>git_default_branch_rediscover</a></span><span class='op'>(</span><span class='op'>)</span></span></code></pre>
21592186
</div>
21602187
</div>
21612188
<h4 id="set-up-git-and-manage-github-credentials">set-up git and manage
21622189
GitHub credentials</h4>
21632190
<div class="layout-chunk" data-layout="l-body">
21642191
<div class="sourceCode">
2165-
<pre class="sourceCode r"><code class="sourceCode r"><span class='co'># Sign-in to your GitHub account</span>
2166-
<span class='co'># Read: https://usethis.r-lib.org/articles/articles/git-credentials.html</span>
2167-
<span class='co'># Read: https://usethis.r-lib.org/articles/articles/usethis-setup.html</span>
2168-
<span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/github-token.html'>create_github_token</a></span><span class='op'>(</span><span class='op'>)</span>
2169-
<span class='fu'>gitcreds</span><span class='fu'>::</span><span class='fu'><a href='https://rdrr.io/pkg/gitcreds/man/gitcreds_get.html'>gitcreds_set</a></span><span class='op'>(</span><span class='op'>)</span>
2170-
<span class='fu'>gh</span><span class='fu'>::</span><span class='fu'><a href='https://gh.r-lib.org/reference/gh_whoami.html'>gh_whoami</a></span><span class='op'>(</span><span class='op'>)</span>
2171-
<span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/git_sitrep.html'>git_sitrep</a></span><span class='op'>(</span><span class='op'>)</span>
2172-
<span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/use_git_config.html'>use_git_config</a></span><span class='op'>(</span>user.name <span class='op'>=</span> <span class='st'>"Jane Doe"</span>, user.email <span class='op'>=</span> <span class='st'>"[email protected]"</span><span class='op'>)</span>
2173-
<span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/git_sitrep.html'>git_sitrep</a></span><span class='op'>(</span><span class='op'>)</span>
2174-
</code></pre>
2192+
<pre class="sourceCode r"><code class="sourceCode r"><span><span class='co'># Sign-in to your GitHub account</span></span>
2193+
<span><span class='co'># Read: https://usethis.r-lib.org/articles/articles/git-credentials.html</span></span>
2194+
<span><span class='co'># Read: https://usethis.r-lib.org/articles/articles/usethis-setup.html</span></span>
2195+
<span><span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/github-token.html'>create_github_token</a></span><span class='op'>(</span><span class='op'>)</span></span>
2196+
<span><span class='fu'>gitcreds</span><span class='fu'>::</span><span class='fu'><a href='https://rdrr.io/pkg/gitcreds/man/gitcreds_get.html'>gitcreds_set</a></span><span class='op'>(</span><span class='op'>)</span></span>
2197+
<span><span class='fu'>gh</span><span class='fu'>::</span><span class='fu'><a href='https://gh.r-lib.org/reference/gh_whoami.html'>gh_whoami</a></span><span class='op'>(</span><span class='op'>)</span></span>
2198+
<span><span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/github-token.html'>gh_token_help</a></span><span class='op'>(</span><span class='op'>)</span></span>
2199+
<span><span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/use_git_config.html'>use_git_config</a></span><span class='op'>(</span>user.name <span class='op'>=</span> <span class='st'>"Jane Doe"</span>, user.email <span class='op'>=</span> <span class='st'>"[email protected]"</span><span class='op'>)</span></span>
2200+
<span><span class='fu'>usethis</span><span class='fu'>::</span><span class='fu'><a href='https://usethis.r-lib.org/reference/github-token.html'>gh_token_help</a></span><span class='op'>(</span><span class='op'>)</span></span></code></pre>
21752201
</div>
21762202
</div>
21772203
<h3 id="next-level">Next Level…</h3>

docs/resources.html

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,17 @@
5050
}
5151
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
5252
div.sourceCode
53-
{ }
53+
{ color: #00769e; background-color: #f1f3f5; }
5454
@media screen {
5555
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
5656
}
57+
code span { color: #00769e; } /* Normal */
5758
code span.al { color: #ad0000; } /* Alert */
5859
code span.an { color: #5e5e5e; } /* Annotation */
59-
code span.at { } /* Attribute */
60+
code span.at { color: #657422; } /* Attribute */
6061
code span.bn { color: #ad0000; } /* BaseN */
6162
code span.bu { } /* BuiltIn */
62-
code span.cf { color: #007ba5; } /* ControlFlow */
63+
code span.cf { color: #00769e; } /* ControlFlow */
6364
code span.ch { color: #20794d; } /* Char */
6465
code span.cn { color: #8f5902; } /* Constant */
6566
code span.co { color: #5e5e5e; } /* Comment */
@@ -73,9 +74,9 @@
7374
code span.fu { color: #4758ab; } /* Function */
7475
code span.im { } /* Import */
7576
code span.in { color: #5e5e5e; } /* Information */
76-
code span.kw { color: #007ba5; } /* Keyword */
77+
code span.kw { color: #00769e; } /* Keyword */
7778
code span.op { color: #5e5e5e; } /* Operator */
78-
code span.ot { color: #007ba5; } /* Other */
79+
code span.ot { color: #00769e; } /* Other */
7980
code span.pp { color: #ad0000; } /* Preprocessor */
8081
code span.sc { color: #5e5e5e; } /* SpecialChar */
8182
code span.ss { color: #20794d; } /* SpecialString */
@@ -1030,10 +1031,6 @@ <h3>${suggestion.title}</h3>
10301031
margin-top: 1.5em;
10311032
}
10321033

1033-
.figure img {
1034-
width: 100%;
1035-
}
1036-
10371034
.figure .caption {
10381035
color: rgba(0, 0, 0, 0.6);
10391036
font-size: 12px;
@@ -1863,6 +1860,12 @@ <h3>${suggestion.title}</h3>
18631860

18641861
// hoverable references
18651862
$('span.citation[data-cites]').each(function() {
1863+
if ($(this).children()[0].nodeName == "D-FOOTNOTE") {
1864+
var fn = $(this).children()[0]
1865+
$(this).html(fn.shadowRoot.querySelector("sup"))
1866+
$(this).id = fn.id
1867+
fn.remove()
1868+
}
18661869
var refs = $(this).attr('data-cites').split(" ");
18671870
var refHtml = refs.map(function(ref) {
18681871
return "<p>" + $('#ref-' + ref).html() + "</p>";
@@ -1878,6 +1881,31 @@ <h3>${suggestion.title}</h3>
18781881
});
18791882
});
18801883

1884+
// fix footnotes in tables (#411)
1885+
// replacing broken distill.pub feature
1886+
$('table d-footnote').each(function() {
1887+
// we replace internal showAtNode methode which is triggered when hovering a footnote
1888+
this.hoverBox.showAtNode = function(node) {
1889+
// ported from https://github.com/distillpub/template/pull/105/files
1890+
calcOffset = function(elem) {
1891+
let x = elem.offsetLeft;
1892+
let y = elem.offsetTop;
1893+
// Traverse upwards until an `absolute` element is found or `elem`
1894+
// becomes null.
1895+
while (elem = elem.offsetParent && elem.style.position != 'absolute') {
1896+
x += elem.offsetLeft;
1897+
y += elem.offsetTop;
1898+
}
1899+
1900+
return { left: x, top: y };
1901+
}
1902+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop
1903+
const bbox = node.getBoundingClientRect();
1904+
const offset = calcOffset(node);
1905+
this.show([offset.left + bbox.width, offset.top + bbox.height]);
1906+
}
1907+
})
1908+
18811909
// clear polling timer
18821910
clearInterval(tid);
18831911

@@ -1976,6 +2004,8 @@ <h3>${suggestion.title}</h3>
19762004
// mark non-body figures created by knitr chunks as 100% width
19772005
$('.layout-chunk').each(function(i, val) {
19782006
var figures = $(this).find('img, .html-widget');
2007+
// ignore leaflet img layers (#106)
2008+
figures = figures.filter(':not(img[class*="leaflet"])')
19792009
if ($(this).attr('data-layout') !== "l-body") {
19802010
figures.css('width', '100%');
19812011
} else {
@@ -1998,7 +2028,7 @@ <h3>${suggestion.title}</h3>
19982028
// get rid of index.html references in header
19992029
if (window.location.protocol !== "file:") {
20002030
$('.distill-site-header a[href]').each(function(i,val) {
2001-
$(this).attr('href', $(this).attr('href').replace("index.html", "./"));
2031+
$(this).attr('href', $(this).attr('href').replace(/^index[.]html/, "./"));
20022032
});
20032033
}
20042034

@@ -2037,7 +2067,7 @@ <h3>${suggestion.title}</h3>
20372067
</script>
20382068

20392069
<!--/radix_placeholder_distill-->
2040-
<script src="site_libs/header-attrs-2.13/header-attrs.js"></script>
2070+
<script src="site_libs/header-attrs-2.16/header-attrs.js"></script>
20412071
<script src="site_libs/popper-2.6.0/popper.min.js"></script>
20422072
<link href="site_libs/tippy-6.2.7/tippy.css" rel="stylesheet" />
20432073
<link href="site_libs/tippy-6.2.7/tippy-light-border.css" rel="stylesheet" />

0 commit comments

Comments
 (0)