style
This commit is contained in:
@@ -29,7 +29,7 @@ Keep it short (3–5 sentences)
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
(“Oliver had a little school surviving on donors from all over the world. He was very sad, because the administration was a real time vampire. He did not have much time teaching the kids, and most of his day was lost in spreadsheets, emails, and manual reporting.”)
|
“Oliver had a little school surviving on donors from all over the world. He was very sad, because the administration was a real time vampire. He did not have much time teaching the kids, and most of his day was lost in spreadsheets, emails, and manual reporting.”
|
||||||
|
|
||||||
2. ⚙️ Neutral System Improvement (No product mention)
|
2. ⚙️ Neutral System Improvement (No product mention)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
You are working for a marketing firm.
|
You are working for a marketing firm.
|
||||||
|
Your name is Joe Doe
|
||||||
Your role is to provide clear, actionable, and practical expertise across all areas of marketing, including strategy, branding, content, growth, advertising, and analytics.
|
Your role is to provide clear, actionable, and practical expertise across all areas of marketing, including strategy, branding, content, growth, advertising, and analytics.
|
||||||
|
|
||||||
Guidelines:
|
Guidelines:
|
||||||
|
|||||||
+10
-1
@@ -20,7 +20,7 @@ app.get('/api/tree', (req, res) => {
|
|||||||
const items = entries.map(e => ({
|
const items = entries.map(e => ({
|
||||||
name: e.name,
|
name: e.name,
|
||||||
path: path.join(rel, e.name).replace(/\\/g,'/'),
|
path: path.join(rel, e.name).replace(/\\/g,'/'),
|
||||||
type: e.isDirectory() ? 'dir' : (e.isFile() && e.name.endsWith('.md') ? 'file' : 'other')
|
type: e.isDirectory() ? 'dir' : (e.isFile() && (e.name.endsWith('.md') || e.name.endsWith('.html')) ? 'file' : 'other')
|
||||||
})).filter(i => i.type !== 'other'); // hide non‑md files
|
})).filter(i => i.type !== 'other'); // hide non‑md files
|
||||||
res.json(items);
|
res.json(items);
|
||||||
});
|
});
|
||||||
@@ -32,6 +32,15 @@ app.get('/api/md', (req, res) => {
|
|||||||
if (!rel) return res.status(400).json({error: 'path is required'});
|
if (!rel) return res.status(400).json({error: 'path is required'});
|
||||||
const absPath = path.join(MD_ROOT, rel);
|
const absPath = path.join(MD_ROOT, rel);
|
||||||
if (!absPath.startsWith(MD_ROOT)) return res.status(400).json({error: 'invalid path'});
|
if (!absPath.startsWith(MD_ROOT)) return res.status(400).json({error: 'invalid path'});
|
||||||
|
// Serve HTML files by returning their raw content inside a JSON wrapper (compatible with client)
|
||||||
|
if (absPath.endsWith('.html')) {
|
||||||
|
return fs.readFile(absPath, 'utf8', (err, data) => {
|
||||||
|
if (err) return res.status(404).json({error: err.message});
|
||||||
|
// Return as JSON with an "html" field, same shape as markdown rendering
|
||||||
|
return res.json({html: data});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// For markdown files, render to HTML
|
||||||
fs.readFile(absPath, 'utf8', (err, data) => {
|
fs.readFile(absPath, 'utf8', (err, data) => {
|
||||||
if (err) return res.status(404).json({error: err.message});
|
if (err) return res.status(404).json({error: err.message});
|
||||||
const html = md.render(data);
|
const html = md.render(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user