Skip to content

Commit 4d4fab3

Browse files
committed
add a Link component to emphasize the renderer interface
1 parent 4aeb4be commit 4d4fab3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/MultiDocumenter.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ function MultiDocRef(;
8181
MultiDocRef(upstream, path, name, fix_canonical_url, giturl, branch)
8282
end
8383

84+
85+
struct Link <: MultiDocumenter.DropdownComponent
86+
text::String
87+
link::String
88+
end
89+
90+
Link(link::String) = Link(link, link)
91+
8492
struct DropdownNav
8593
name::String
8694
children::Vector{DropdownComponent}

src/renderers.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ function render(doc::MultiDocRef, dir, thispagepath, prettyurls)
3636
"""
3737
end
3838

39+
function render(c::Link, doc, thispage, prettyurls)
40+
return @htl """
41+
<a href=$(c.link) class="nav-link nav-item">$(c.text)</a>
42+
""" # TODO: add "external link" icon after, either chain or arrow exiting box.
43+
end
44+
3945
function render(doc::DropdownNav, dir, thispagepath, prettyurls)
4046
return @htl """
4147
<div class="nav-dropdown">

0 commit comments

Comments
 (0)