-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.html
131 lines (115 loc) · 5.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HexDocs</title>
<link rel="stylesheet" href="/complete.css">
<link rel="shortcut icon" href="/favicon.png">
</head>
<body>
<div class="splash-container">
<div class="splash">
<img src="hexdocs-text.png" srcset="/hexdocs-text.png 1x, [email protected] 2x, [email protected] 3x">
<p class="splash-subhead">HexDocs is a place for Hex packages to host their documentation.</p>
<br>
<h3>Finding documentation</h3>
<form autocomplete="off">
<input type="search" autofocus="" placeholder="Find packages" name="search" id="search" value="" tabindex="1"><!--
--><label class="sr-only" for="search">Find packages</label><!--
--><button type="submit" id="search-submit" tabindex="1"><svg aria-hidden="aria-hidden" version="1.1" viewBox="0 0 1200 1200"><g transform="translate(0, 1200) scale(1, -1)"><path d="M500 1191q100 0 191 -39t156.5 -104.5t104.5 -156.5t39 -191l-1 -2l1 -5q0 -141 -78 -262l275 -274q23 -26 22.5 -44.5t-22.5 -42.5l-59 -58q-26 -20 -46.5 -20t-39.5 20l-275 274q-119 -77 -261 -77l-5 1l-2 -1q-100 0 -191 39t-156.5 104.5t-104.5 156.5t-39 191 t39 191t104.5 156.5t156.5 104.5t191 39zM500 1022q-88 0 -162 -43t-117 -117t-43 -162t43 -162t117 -117t162 -43t162 43t117 117t43 162t-43 162t-117 117t-162 43z"></path></g></svg></button>
</form>
<ul id="search-results"></ul>
<p>
To find documentation sets on HexDocs, you can go to the following URLs:
</p>
<p>
<code>https://hexdocs.pm/<package>/</code> - Latest documentation set for <code>package</code>
<br>
Example: <code>https://hexdocs.pm/ecto/</code>
</p>
<p>
<code>https://hexdocs.pm/<package>/<version></code> - Documentation set for <code>package</code> at <code>version</code>
<br>
Example: <code>https://hexdocs.pm/ecto/1.1.9/</code>
</p>
<p>
You can also find documentation sets in the release section of package pages on Hex.pm
</p>
<br>
<h3>Publishing documentation</h3>
<p>
Documentation is automatically published when you publish your package, you can find more information <a href="https://hexdocs.pm/hex/Mix.Tasks.Hex.Publish.html">here</a>.
</p>
<p>
Learn how to write documentation <a href="https://hexdocs.pm/elixir/main/writing-documentation.html">here</a>.
</p>
<br>
<p class="splash-subhead">
<a href="https://hex.pm/">Go back to Hex</a>
</p>
<p>
<small>
Is something wrong? Let us know by <a href="https://github.com/hexpm/hex_web/issues">opening an issue</a> or <a href="mailto:[email protected]">emailing support</a>.
</small>
</p>
</div>
</div>
<script type="text/javascript">
var searchIndex = [];
(function () {
document.getElementById('search-submit').addEventListener("click", function (e) {
e.preventDefault();
e.stopPropagation();
if (!searchIndex.length) buildSearchIndex();
var searchText = document.getElementById('search').value.toLowerCase();
var searchResults = document.getElementById('search-results');
searchResults.innerHTML = "";
for (var i = 0; i < searchIndex.length; i++) {
if (searchIndex[i].name === searchText) {
var li = document.createElement("li");
li.innerHTML = "<em>" + makeMatch(searchIndex[i]) + "</em>";
searchResults.insertBefore(li, searchResults.firstChild);
} else if (searchIndex[i].name.search(searchText) >= 0) {
var li = document.createElement("li");
li.innerHTML = makeMatch(searchIndex[i]);
searchResults.appendChild(li);
}
}
return true;
});
function buildSearchIndex() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == XMLHttpRequest.DONE && this.status == 200) {
out = this.responseXML;
var locs = this.responseXML.querySelectorAll("loc");
for (var idx = 0; idx < locs.length; idx++) {
var loc = locs[idx].textContent.replace(/sitemap.xml$/, "");
var name = loc.match("/(\\w+)/$")[1].toLowerCase();
searchIndex.push({ name: name, url: loc });
}
addElixirCoreApps()
}
};
xhttp.open("GET", "/sitemap.xml", false);
xhttp.send();
}
function addElixirCoreApps() {
searchIndex.push({ name: "eex", url: "https://hexdocs.pm/eex" });
searchIndex.push({ name: "elixir", url: "https://hexdocs.pm/elixir" });
searchIndex.push({ name: "ex_unit", url: "https://hexdocs.pm/ex_unit" });
searchIndex.push({ name: "iex", url: "https://hexdocs.pm/iex" });
searchIndex.push({ name: "logger", url: "https://hexdocs.pm/logger" });
searchIndex.push({ name: "mix", url: "https://hexdocs.pm/mix" });
searchIndex.push({ name: "hex", url: "https://hexdocs.pm/hex" });
}
function makeMatch(result) {
return "<a href='{{url}}'>{{name}}</a>"
.replace(/{{name}}/g, result.name)
.replace(/{{url}}/g, result.url);
}
})();
</script>
</body>
</html>