diff --git a/src/renderers/htmlRenderer.ts b/src/renderers/htmlRenderer.ts index e1bf062..6b4b03f 100644 --- a/src/renderers/htmlRenderer.ts +++ b/src/renderers/htmlRenderer.ts @@ -137,6 +137,9 @@ export class HTMLRenderer implements DjockeyRenderer { doc, docs: renderedDocs, baseURL, + github: { + path: parseGitHubPath(config.projectInfo?.githubURL), + }, urls: { css: config.html.linkCSSToInputInsteadOfOutput ? this.cssFilePaths @@ -151,6 +154,12 @@ export class HTMLRenderer implements DjockeyRenderer { } } +function parseGitHubPath(maybeURL?: string): string | undefined { + const GH_BASE = "https://github.com/"; + if (!maybeURL || !maybeURL.startsWith(GH_BASE)) return maybeURL; + return maybeURL.slice(GH_BASE.length); +} + interface Element { attrs: { name: string; value: string }[]; childNodes: (Element | TextNode)[]; diff --git a/templates/html/base.njk b/templates/html/base.njk index 298df30..6e8fe49 100644 --- a/templates/html/base.njk +++ b/templates/html/base.njk @@ -29,7 +29,7 @@
{%- if config.projectInfo.githubURL -%}
- GitHub + {{ github.path or "GitHub" }}
{%- endif %} {%- if config.projectInfo.version %} diff --git a/templates/html/static/dj-style.css b/templates/html/static/dj-style.css index fcd5bdb..4b0b2d9 100644 --- a/templates/html/static/dj-style.css +++ b/templates/html/static/dj-style.css @@ -202,6 +202,7 @@ nav h6 { } .DJNextPrevious.m-bottom { + margin-top: var(--ml); margin-bottom: var(--mm); }