Skip to content

Commit dc9186c

Browse files
authored
Merge pull request #159 from kmyk/midashi-anchor
見出しに anchor を付けます
2 parents eb0555c + 85f69dc commit dc9186c

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

_sass/style.scss

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,23 @@
5252
clear: both;
5353
}
5454

55-
// external links in index.md
56-
.link-external svg.octicon {
55+
// links in index.md
56+
a.draft-link {
57+
color: black;
58+
}
59+
.draft-link-container svg.octicon-link {
60+
visibility: hidden;
61+
}
62+
.draft-link-external svg.octicon-link-external {
5763
fill: currentColor;
5864
}
65+
a.draft-link:hover {
66+
text-decoration: none;
67+
}
68+
.draft-link-container:hover svg.octicon-link {
69+
visibility: visible;
70+
fill: grey;
71+
}
5972

6073
// footer links
6174
#staging-environment-warning {

index.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@
1313
{% assign sorted_algorithms = site.algorithms | sort: "title" %}
1414
{% for entry in sorted_algorithms %}
1515
{% unless entry.tenkei %}
16-
<dt>
16+
{% assign entry_id = entry.url | split: "/" | last | split: "." | first %}
17+
<dt id="{{ entry_id }}">
1718
{% if entry.algorithm.level %}
1819
<span style="font-style: normal;" class="rating-color-{{ entry.algorithm.level }}">&#x25C9;</span>
1920
{% endif %}
21+
22+
{% if entry.draft %}
23+
<span href="#{{ entry_id }}" class="draft-link-container">
24+
<a href="#{{ entry_id }}" class="draft-link">
25+
{% endif %}
26+
2027
{% if entry.draft %}
2128
{{ entry.title }}
2229
{% else %}
@@ -28,7 +35,10 @@
2835
{% endif %}
2936

3037
{% if entry.draft %}
31-
{% for url in entry.draft_urls %} <a href="{{ url }}" class="link-external">{% octicon link-external height:16 %}</a>{% endfor %}
38+
</a>
39+
{% for url in entry.draft_urls %} <a href="{{ url }}" class="draft-link-external">{% octicon link-external height:16 %}</a>{% endfor %}
40+
{% octicon link height:16 %}
41+
</span>
3242
{% endif %}
3343
</dt>
3444
<dd>

tenkei/index.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77
<dl>
88
{% assign sorted_tenkeis = site.tenkeis | sort: "title" %}
99
{% for entry in sorted_tenkeis %}
10+
{% assign entry_id = entry.url | split: "/" | last | split: "." | first %}
1011
{% if entry.draft %}
11-
<dt>{{ entry.title }}{% for url in entry.draft_urls %} <a href="{{ url }}" class="link-external">{% octicon link-external height:16 %}</a>{% endfor %}</dt>
12+
<dt id="{{ entry_id }}">
13+
<span href="#{{ entry_id }}" class="draft-link-container">
14+
<a href="#{{ entry_id }}" class="draft-link">
15+
{{ entry.title }}
16+
</a>
17+
{% for url in entry.draft_urls %} <a href="{{ url }}" class="draft-link-external">{% octicon link-external height:16 %}</a>{% endfor %}
18+
{% octicon link height:16 %}
19+
</span>
20+
</dt>
1221
<dd>{{ entry.description }}</dd>
1322
{% else %}
1423
<dt><a href="{{ entry.url | relative_url }}">{{ entry.title }}</a></dt>

0 commit comments

Comments
 (0)