Skip to content

Commit

Permalink
Use .dj canonically instead of .djot (fix #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
irskep committed Aug 27, 2024
1 parent bf12300 commit a112bc4
Show file tree
Hide file tree
Showing 40 changed files with 41 additions and 97 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions docs/src/basics/linking.djot → docs/src/basics/linking.dj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Everything you can do in Markdown, you can also do in Djockey. If you find that

## Extension or no extension, up to you

If you have a doc at `life.djot`, you can link to it with either `[link text](life.djot)` or just `[link text](life)`.
If you have a doc at `life.dj`, you can link to it with either `[link text](life.dj)` or just `[link text](life)`.

## Static files

Expand All @@ -15,16 +15,16 @@ You can link to static files using relative paths, or absolute paths where the r
Let's say you wrote some text you need to refer to in many places across your docs, and gave it a custom identifier:

```djot
{% in /reference/answers/big-questions/life.djot %}
{% in /reference/answers/big-questions/life.dj %}
{#the-answer}
# The answer to life, the universe, and everything

It's 42.
```

In any other documentation system, you'd need to link to `/reference/answers/big-questions/life#the-answer`{.language-sh}, or use a relative URL like `../../answers/big-questions/life#the-answer`{.language-sh}. But if you move `life.djot`{.language-sh} to another directory, you need to find all those links and update them.
In any other documentation system, you'd need to link to `/reference/answers/big-questions/life#the-answer`{.language-sh}, or use a relative URL like `../../answers/big-questions/life#the-answer`{.language-sh}. But if you move `life.dj`{.language-sh} to another directory, you need to find all those links and update them.

With Djockey, you can link to it anywhere with just `#the-answer`{.language-css}, and Djockey will figure out which doc it lives in. If there are two files containing a heading `#the-answer`{.language-css}, you can use just enough of the path to disambiguate the two, like `life#the-answer`{.language-sh} or `answers/big-questions/life.djot#the-answer`{.language-sh}.
With Djockey, you can link to it anywhere with just `#the-answer`{.language-css}, and Djockey will figure out which doc it lives in. If there are two files containing a heading `#the-answer`{.language-css}, you can use just enough of the path to disambiguate the two, like `life#the-answer`{.language-sh} or `answers/big-questions/life.dj#the-answer`{.language-sh}.

The goal of this feature is to make it easier to reorganize your docs on the fly. If there's any ambiguity, Djockey will warn you at build time.

Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions docs/src/basics/sections.dj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
order: 2
---
# Sections

Djockey uses the directory tree to group documents into sections and subsections.

## `index.dj`

Put an `index.dj` (or `index.md`) file in any directory to customize its metadata (`title`, `order`) and give the beginning of the section some content.

If `index.dj` contains front matter but no content, then the section will use the front matter, but no page will be rendered. As an example, see the "Plugins" vs "Writing with Djockey" sections on this site.
12 changes: 0 additions & 12 deletions docs/src/basics/sections.djot

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions examples/frontmatter.djot

This file was deleted.

1 change: 0 additions & 1 deletion examples/full/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions examples/full/djockey.yaml

This file was deleted.

1 change: 0 additions & 1 deletion examples/full/docs/crispy.djot

This file was deleted.

Binary file removed examples/full/docs/image.png
Binary file not shown.
20 changes: 0 additions & 20 deletions examples/full/docs/index.md

This file was deleted.

3 changes: 0 additions & 3 deletions examples/full/docs/layer/inner.djot

This file was deleted.

4 changes: 0 additions & 4 deletions examples/full/docs/layer/layer2/index.djot

This file was deleted.

1 change: 0 additions & 1 deletion examples/full/docs/layer/layer2/inner2.djot

This file was deleted.

1 change: 0 additions & 1 deletion examples/full/docs/layer/meta.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions examples/full/docs/second.djot

This file was deleted.

1 change: 0 additions & 1 deletion examples/full/docs/staticfile.txt

This file was deleted.

4 changes: 2 additions & 2 deletions src/input/fileExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { ALL_INPUT_FORMATS, DjockeyInputFormat } from "../types.js";
export function getExtensionForInputFormat(fmt: DjockeyInputFormat): string[] {
switch (fmt) {
case "gfm":
return ["md"];
return ["md", "markdown"];
case "djot":
return ["djot"];
return ["djot", "dj"];
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/plugins/autoTitlePlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ test("Title is set to first heading by default", () => {
},
title: "Test doc",
titleAST: [{ tag: "str", text: "Test doc" }],
originalExtension: ".djot",
absolutePath: "Test Doc.djot",
relativePath: "Test Doc.djot",
originalExtension: ".dj",
absolutePath: "Test Doc.dj",
relativePath: "Test Doc.dj",
filename: "Test Doc",
frontMatter: {},
data: {},
Expand All @@ -34,7 +34,7 @@ test("Title is set to first heading by default", () => {
inputDir: ".",
rootPath: ".",
outputDir: { html: "./dist/html", gfm: "./dist/gfm" },
fileList: ["Test Doc.djot"],
fileList: ["Test Doc.dj"],
urlRoot: "URL_ROOT",
inputFormats: { djot: true },
};
Expand All @@ -61,9 +61,9 @@ test("Title is set to frontMatter.title if present", () => {
},
title: "Test doc",
titleAST: [{ tag: "str", text: "Test doc" }],
originalExtension: ".djot",
absolutePath: "Test Doc.djot",
relativePath: "Test Doc.djot",
originalExtension: ".dj",
absolutePath: "Test Doc.dj",
relativePath: "Test Doc.dj",
filename: "Test Doc",
frontMatter: { title: "Custom title" },
data: {},
Expand All @@ -74,7 +74,7 @@ test("Title is set to frontMatter.title if present", () => {
inputDir: ".",
rootPath: ".",
outputDir: { html: "./dist/html", gfm: "./dist/gfm" },
fileList: ["Test Doc.djot"],
fileList: ["Test Doc.dj"],
urlRoot: "URL_ROOT",
};
const docSet = new DocSet(config, [new AutoTitlePlugin()], [doc]);
Expand Down
30 changes: 15 additions & 15 deletions src/plugins/tableOfContentsPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ test("Generates TOCEntry tree for one doc", () => {
},
title: "Test doc",
titleAST: [{ tag: "str", text: "Test doc" }],
originalExtension: ".djot",
absolutePath: "Test Doc.djot",
relativePath: "Test Doc.djot",
originalExtension: ".dj",
absolutePath: "Test Doc.dj",
relativePath: "Test Doc.dj",
filename: "Test Doc",
frontMatter: {},
data: {},
Expand All @@ -39,18 +39,18 @@ test("Generates TOCEntry tree for one doc", () => {

expect(html).toEqual(`<ul>
<li>
<a href="/Test Doc.djot#Heading-1">Heading 1</a>
<a href="/Test Doc.dj#Heading-1">Heading 1</a>
<ul>
<li>
<a href="/Test Doc.djot#Heading-1-1">Heading 1.1</a>
<a href="/Test Doc.dj#Heading-1-1">Heading 1.1</a>
</li>
</ul>
</li>
<li>
<a href="/Test Doc.djot#Heading-2">Heading 2</a>
<a href="/Test Doc.dj#Heading-2">Heading 2</a>
<ul>
<li>
<a href="/Test Doc.djot#Heading-2-2">Heading 2.2</a>
<a href="/Test Doc.dj#Heading-2-2">Heading 2.2</a>
</li>
</ul>
</li>
Expand All @@ -75,9 +75,9 @@ test("Works end-to-end with LinkRewritingPlugin", () => {
},
title: "Test doc",
titleAST: [{ tag: "str", text: "Test doc" }],
originalExtension: ".djot",
absolutePath: "Test Doc.djot",
relativePath: "Test Doc.djot",
originalExtension: ".dj",
absolutePath: "Test Doc.dj",
relativePath: "Test Doc.dj",
filename: "Test Doc",
frontMatter: {},
data: {},
Expand All @@ -87,7 +87,7 @@ test("Works end-to-end with LinkRewritingPlugin", () => {
...getConfigDefaults(),
inputDir: ".",
outputDir: { html: "./dist/html", gfm: "./dist/gfm" },
fileList: ["Test Doc.djot"],
fileList: ["Test Doc.dj"],
urlRoot: "URL_ROOT",
inputFormats: { djot: true },
rootPath: ".",
Expand All @@ -106,18 +106,18 @@ test("Works end-to-end with LinkRewritingPlugin", () => {

expect(html).toEqual(`<ul>
<li>
<a href="Test Doc.djot.html#Heading-1">Heading 1</a>
<a href="Test Doc.dj.html#Heading-1">Heading 1</a>
<ul>
<li>
<a href="Test Doc.djot.html#Heading-1-1">Heading 1.1</a>
<a href="Test Doc.dj.html#Heading-1-1">Heading 1.1</a>
</li>
</ul>
</li>
<li>
<a href="Test Doc.djot.html#Heading-2">Heading 2</a>
<a href="Test Doc.dj.html#Heading-2">Heading 2</a>
<ul>
<li>
<a href="Test Doc.djot.html#Heading-2-2">Heading 2.2</a>
<a href="Test Doc.dj.html#Heading-2-2">Heading 2.2</a>
</li>
</ul>
</li>
Expand Down

0 comments on commit a112bc4

Please sign in to comment.