devfolio-page 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseMarkdown, highlightCode, parseBio } from './markdown.js';
|
|
1
|
+
import { parseMarkdown, parseMarkdownProse, highlightCode, parseBio } from './markdown.js';
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import Mustache from 'mustache';
|
|
@@ -177,6 +177,8 @@ async function generateHomepage(portfolio, themePath, outputDir, theme) {
|
|
|
177
177
|
hasProjects: (portfolio.projects?.length ?? 0) > 0,
|
|
178
178
|
hasExperiments: (portfolio.experiments?.length ?? 0) > 0,
|
|
179
179
|
hasWriting: (portfolio.sections.writing?.length ?? 0) > 0,
|
|
180
|
+
// Navigation links
|
|
181
|
+
nav_links: generateNavLinks(portfolio, false, 'home'),
|
|
180
182
|
};
|
|
181
183
|
const html = Mustache.render(template, data);
|
|
182
184
|
await fs.writeFile(path.join(outputDir, 'index.html'), html);
|
|
@@ -262,7 +264,7 @@ async function generateAboutPage(portfolio, themePath, outputDir, theme) {
|
|
|
262
264
|
site_name: portfolio.meta.name,
|
|
263
265
|
tagline: portfolio.meta.tagline,
|
|
264
266
|
avatar: portfolio.meta.avatar,
|
|
265
|
-
about_content:
|
|
267
|
+
about_content: parseMarkdownProse(portfolio.about?.long || portfolio.about?.short || ''),
|
|
266
268
|
contact: portfolio.contact,
|
|
267
269
|
hasContact: !!(portfolio.contact?.email || portfolio.contact?.github || portfolio.contact?.linkedin || portfolio.contact?.twitter || portfolio.contact?.website),
|
|
268
270
|
skills: skillsArray,
|
|
@@ -770,6 +772,7 @@ async function generateHomepageInMemory(portfolio, themePath, theme, files) {
|
|
|
770
772
|
hasProjects: (portfolio.projects?.length ?? 0) > 0,
|
|
771
773
|
hasExperiments: (portfolio.experiments?.length ?? 0) > 0,
|
|
772
774
|
hasWriting: (portfolio.sections.writing?.length ?? 0) > 0,
|
|
775
|
+
nav_links: generateNavLinks(portfolio, false, 'home'),
|
|
773
776
|
};
|
|
774
777
|
const html = Mustache.render(template, data);
|
|
775
778
|
files.set('index.html', Buffer.from(html, 'utf-8'));
|
|
@@ -848,7 +851,7 @@ async function generateAboutPageInMemory(portfolio, themePath, theme, files) {
|
|
|
848
851
|
site_name: portfolio.meta.name,
|
|
849
852
|
tagline: portfolio.meta.tagline,
|
|
850
853
|
avatar: portfolio.meta.avatar,
|
|
851
|
-
about_content:
|
|
854
|
+
about_content: parseMarkdownProse(portfolio.about?.long || portfolio.about?.short || ''),
|
|
852
855
|
contact: portfolio.contact,
|
|
853
856
|
hasContact: !!(portfolio.contact?.email || portfolio.contact?.github || portfolio.contact?.linkedin || portfolio.contact?.twitter || portfolio.contact?.website),
|
|
854
857
|
skills: skillsArray,
|
|
@@ -10,6 +10,18 @@ marked.setOptions({
|
|
|
10
10
|
export function parseMarkdown(content) {
|
|
11
11
|
return marked.parse(content);
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Parse markdown content to HTML without converting single newlines to <br>
|
|
15
|
+
* Use this for prose content like about pages where normal paragraph flow is expected
|
|
16
|
+
*/
|
|
17
|
+
export function parseMarkdownProse(content) {
|
|
18
|
+
// Temporarily disable breaks for this parse
|
|
19
|
+
const originalBreaks = marked.defaults.breaks;
|
|
20
|
+
marked.setOptions({ breaks: false });
|
|
21
|
+
const result = marked.parse(content);
|
|
22
|
+
marked.setOptions({ breaks: originalBreaks });
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
13
25
|
/**
|
|
14
26
|
* Parse inline markdown (no block elements like <p>)
|
|
15
27
|
*/
|