Skip to content

Commit 5ae71eb

Browse files
authored
Merge pull request #803 from stan-dev/cross-link-index
Add links to index on function definitions
2 parents 48e9943 + 26a4322 commit 5ae71eb

File tree

5 files changed

+1974
-1927
lines changed

5 files changed

+1974
-1927
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ src/**/*.tex
2929

3030
# For the Mac (Finder metatdata files)
3131
*.DS_Store
32+
33+
.luarc.json

gen_index.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def make_index_mapping(sigs):
3737

3838
sha = hashlib.sha1(sig.encode("utf-8")).hexdigest()
3939
link = f"{file}#index-entry-{sha}"
40-
index[name].append((link, index_entry))
40+
index[name].append((link, index_entry, file.replace(".qmd", ".html")))
4141

4242
return index
4343

@@ -53,9 +53,9 @@ def write_index_page(index):
5353
f.write(f"\n## {start.upper()}\n")
5454

5555
escaped_name = name.replace("\\", "\\\\").replace("*", "\\*")
56-
f.write(f"**{escaped_name}**<a id=\"{escaped_name}\" class=\"index-fn\"></a>:\n\n")
57-
for link, entry in sorted(links, key=lambda x: x[1].lower() + x[0]):
58-
f.write(f" - [{entry}]({link})\n")
56+
f.write(f"<a id='{escaped_name}' href='#{escaped_name}' class='anchored unlink'>**{escaped_name}**:</a>\n\n")
57+
for link, entry, file in sorted(links, key=lambda x: x[1].lower() + x[2] + x[0]):
58+
f.write(f" - <div class='index-container'>[{entry}]({link}) <span class='detail'>({file})</span></div>\n")
5959
f.write("\n\n")
6060

6161

0 commit comments

Comments
 (0)