dochub 1.0.2 → 1.0.3
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.
- package/package.json +1 -1
- package/src/init.js +3 -4
- package/templates/server.js +5 -1
package/package.json
CHANGED
package/src/init.js
CHANGED
@@ -95,9 +95,8 @@ function createMarkdownFiles(folderPath) {
|
|
95
95
|
// Function to create config.json
|
96
96
|
function createConfigFile(filePath) {
|
97
97
|
const configData = {
|
98
|
-
title: '
|
99
|
-
description:
|
100
|
-
// Add more configuration as needed
|
98
|
+
title: 'DocHub Project',
|
99
|
+
description: "Change this to your description!"
|
101
100
|
};
|
102
101
|
|
103
102
|
fs.writeFileSync(filePath, JSON.stringify(configData, null, 2));
|
@@ -170,7 +169,7 @@ function initializeNpm(projectPath) {
|
|
170
169
|
|
171
170
|
// Function to install necessary packages
|
172
171
|
function installPackages(projectPath) {
|
173
|
-
const dependencies = ['http', 'fs', 'path', 'highlight.js', 'socket.io'];
|
172
|
+
const dependencies = ['http', 'fs', 'path', 'highlight.js', 'socket.io'];
|
174
173
|
|
175
174
|
animatedLog(`✔ Installing packages: ${dependencies.join(', ')}`, 50);
|
176
175
|
const progressBar = createProgressBar(20);
|
package/templates/server.js
CHANGED
@@ -6,6 +6,10 @@ const socketio = require('socket.io');
|
|
6
6
|
|
7
7
|
let htmlContent = ''; // Variable to store HTML content
|
8
8
|
|
9
|
+
const configPath = path.join(__dirname, 'config.json');
|
10
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
11
|
+
const projectTitle = config.title || 'Documentation Project';
|
12
|
+
|
9
13
|
// Function to convert Markdown to HTML
|
10
14
|
function convertMarkdownToHtml(markdownContent, filePath) {
|
11
15
|
// Regular expression to match Markdown code blocks
|
@@ -104,7 +108,7 @@ function convertMarkdownToHtml(markdownContent, filePath) {
|
|
104
108
|
</head>
|
105
109
|
<body class="flex bg-gray-100">
|
106
110
|
<aside class="w-1/5 bg-gray-800 p-4 sidebar">
|
107
|
-
<h1 class="text-xl font-bold mb-4"
|
111
|
+
<h1 class="text-xl font-bold mb-4">${projectTitle}</h1>
|
108
112
|
<input type="text" id="search-input" class="search-bar" placeholder="Search...">
|
109
113
|
<ul id="sidebar-list" class="space-y-2">
|
110
114
|
${sidebar}
|