Skip to content

Commit

Permalink
Put project version and github URL in heading
Browse files Browse the repository at this point in the history
  • Loading branch information
irskep committed Aug 27, 2024
1 parent 4b500ae commit 98a5059
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 21 deletions.
3 changes: 3 additions & 0 deletions docs/djockey.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ outputDir:
gfm: out/gfm
siteName: "Djockey"
urlRoot: https://steveasleep.com/djockey
projectInfo:
version: 0.0.1
githubURL: https://github.com/irskep/djockey

outputFormats:
html: true
Expand Down
3 changes: 3 additions & 0 deletions docs/src/basics/configuration.djot
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Djockey is pre-alpha and config options _will_ change.
# djockey.yaml
siteName: "Your name here"
urlRoot: "https://your-docs-site-here"
projectInfo:
version: 0.0.1
githubURL: https://github.com/your/project
inputDir: "path to your docs"
outputDir:
html: "path to your HTML output"
Expand Down
47 changes: 26 additions & 21 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
import { Doc } from "@djot/djot";
import { Environment } from "nunjucks";

export type DjockeyDoc = {
docs: { content: Doc } & Record<string, Doc>;
title: string;
originalExtension: string;
absolutePath: string;
relativePath: string;
filename: string;
frontMatter: Record<string, unknown>;

// For use by plugins
data: Record<string, unknown>;
};

// These correspond to pandoc formats. Keep these two lines in sync.
export type DjockeyInputFormat = "djot" | "gfm";
export const ALL_INPUT_FORMATS: DjockeyInputFormat[] = ["djot", "gfm"];

// Keep these two lines in sync.
export type DjockeyOutputFormat = "html" | "gfm";
export const ALL_OUTPUT_FORMATS: DjockeyOutputFormat[] = ["html", "gfm"];

export type DjockeyConfig = {
inputDir: string;
outputDir: Record<DjockeyOutputFormat, string>;
Expand All @@ -32,6 +11,11 @@ export type DjockeyConfig = {
numPasses: number;
siteName: string;

projectInfo?: {
version?: string;
githubURL?: string;
};

plugins: string[];

html: {
Expand All @@ -46,6 +30,27 @@ export type DjockeyConfigResolved = DjockeyConfig & {
urlRoot: string;
};

export type DjockeyDoc = {
docs: { content: Doc } & Record<string, Doc>;
title: string;
originalExtension: string;
absolutePath: string;
relativePath: string;
filename: string;
frontMatter: Record<string, unknown>;

// For use by plugins
data: Record<string, unknown>;
};

// These correspond to pandoc formats. Keep these two lines in sync.
export type DjockeyInputFormat = "djot" | "gfm";
export const ALL_INPUT_FORMATS: DjockeyInputFormat[] = ["djot", "gfm"];

// Keep these two lines in sync.
export type DjockeyOutputFormat = "html" | "gfm";
export const ALL_OUTPUT_FORMATS: DjockeyOutputFormat[] = ["html", "gfm"];

export type DjockeyRenderer = {
identifier: DjockeyOutputFormat;

Expand Down
18 changes: 18 additions & 0 deletions templates/html/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@
</svg>
{%- endmacro -%}

{%- macro header_project_info() -%}
{% if config.projectInfo %}
<div class="DJProjectInfo">
{%- if config.projectInfo.githubURL -%}
<div class="DJProjectInfo_Repo">
<a href="{{ confnig.projectInfo.githubURL }}">GitHub</a>
</div>
{%- endif %}
{%- if config.projectInfo.version %}
<div class="DJProjectInfo_Version">Version {{ config.projectInfo.version }}</div>
{%- endif -%}
</div>
{% endif %}
{%- endmacro -%}

<!doctype html>
<html>
<head>
Expand Down Expand Up @@ -53,6 +68,9 @@
</button>
<h1>{{ config.siteName }}</h1>
</div>
<div class="DJHeader_Content_Group">
{{ header_project_info() }}
</div>
</div>
</header>

Expand Down
5 changes: 5 additions & 0 deletions templates/html/static/dj-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ th {
padding: var(--ms);
}

.DJProjectInfo {
font-size: var(--fs-small);
color: var(--color-fg-2);
}

.DJFooter_Content {
border-top: var(--border-weak);
padding: var(--ms);
Expand Down

0 comments on commit 98a5059

Please sign in to comment.