-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.eleventy.js
More file actions
63 lines (60 loc) · 2.51 KB
/
Copy path.eleventy.js
File metadata and controls
63 lines (60 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const markdownIt = require("markdown-it");
const hljs = require("highlight.js");
module.exports = function (eleventyConfig) {
/* --- Passthrough: فایلهایی که باید کپی بشن --- */
eleventyConfig.addPassthroughCopy("src/styles");
eleventyConfig.addPassthroughCopy("src/fonts");
eleventyConfig.addPassthroughCopy("src/contribute.html");
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy("src/books/book1/assets");
eleventyConfig.addPassthroughCopy("src/books/book2/assets");
eleventyConfig.addPassthroughCopy("src/books/book3/assets");
eleventyConfig.addPassthroughCopy("src/books/book4/assets");
eleventyConfig.addPassthroughCopy("src/books/book5/assets");
eleventyConfig.addPassthroughCopy("src/books/book6/assets");
eleventyConfig.addPassthroughCopy("src/books/book7/assets");
eleventyConfig.addPassthroughCopy("src/books/book8/assets");
eleventyConfig.addPassthroughCopy({ "src/favicon.png": "favicon.png" });
eleventyConfig.addPassthroughCopy("src/icone");
eleventyConfig.addPassthroughCopy(".nojekyll");
eleventyConfig.addPassthroughCopy({ "src/Giter": "Giter" });
/* --- Markdown با Highlight.js --- */
const markdownLib = markdownIt({
html: true,
breaks: true,
linkify: true,
highlight: function (str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return (
'<pre class="hljs"><code>' +
hljs.highlight(str, {
language: lang,
ignoreIllegals: true,
}).value +
"</code></pre>"
);
} catch (__) {}
}
return (
'<pre class="hljs"><code>' +
markdownIt().utils.escapeHtml(str) +
"</code></pre>"
);
},
});
eleventyConfig.setLibrary("md", markdownLib);
/* --- مسیرهای پروژه --- */
return {
dir: {
input: "src", // مسیر اصلی پروژه
output: "_site", // خروجی سایت
includes: "_includes", // مسیر قالبها (حتماً با آندرلاین)
layouts: "_includes",
},
pathPrefix: "/Gitab/", // 👈 بسیار مهم
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
templateFormats: ["html", "njk", "md"],
};
};