@maizzle/framework 5.0.0-beta.24 → 5.0.0-beta.25
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
CHANGED
package/src/server/index.js
CHANGED
|
@@ -63,7 +63,7 @@ async function renderUpdatedFile(file, config) {
|
|
|
63
63
|
|
|
64
64
|
// beforeCreate event
|
|
65
65
|
if (typeof config.beforeCreate === 'function') {
|
|
66
|
-
await config.beforeCreate(config)
|
|
66
|
+
await config.beforeCreate({ config })
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// Read the file
|
|
@@ -164,11 +164,11 @@ export default async (config = {}) => {
|
|
|
164
164
|
app.get(routePattern, async (req, res, next) => {
|
|
165
165
|
// Run beforeCreate event
|
|
166
166
|
if (typeof config.beforeCreate === 'function') {
|
|
167
|
-
config.beforeCreate(config)
|
|
167
|
+
await config.beforeCreate({ config })
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
try {
|
|
171
|
-
const filePath = templatePaths.find(t => t.endsWith(req.url.slice(1)))
|
|
171
|
+
const filePath = templatePaths.find(t => t.endsWith(decodeURI(req.url.slice(1))))
|
|
172
172
|
|
|
173
173
|
// Set the file being viewed
|
|
174
174
|
viewing = filePath
|
|
@@ -288,7 +288,7 @@ export default async (config = {}) => {
|
|
|
288
288
|
|
|
289
289
|
// Run beforeCreate event
|
|
290
290
|
if (typeof config.beforeCreate === 'function') {
|
|
291
|
-
await config.beforeCreate(config)
|
|
291
|
+
await config.beforeCreate({ config })
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
// Read the file
|
|
@@ -79,6 +79,11 @@
|
|
|
79
79
|
border-left: 1px solid #64748B;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
li.folder.nested > strong {
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
82
87
|
li.folder.root {
|
|
83
88
|
padding-top: 3rem;
|
|
84
89
|
border: none;
|
|
@@ -92,6 +97,15 @@
|
|
|
92
97
|
line-height: 2.25rem;
|
|
93
98
|
}
|
|
94
99
|
|
|
100
|
+
li.file.nested.collapsed {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
li.file.nested.collapsed + .folder.nested {
|
|
105
|
+
padding-top: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
95
109
|
li.file.nested a {
|
|
96
110
|
padding-bottom: 0.75rem;
|
|
97
111
|
margin-left: -1.5rem;
|
|
@@ -143,5 +157,16 @@
|
|
|
143
157
|
</ul>
|
|
144
158
|
|
|
145
159
|
<svg fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 993 483" class="insignia"><mask id="a" style="mask-type:alpha;" maskUnits="userSpaceOnUse" x="0" y="0" width="993" height="483"><path fill="#D9D9D9" d="M0 0h993v483H0z"></path></mask><g mask="url(#a)" stroke="#e2e8f0" stroke-miterlimit="10"><path d="M954.124 81.816c0-45.163-39.678-81.774-88.624-81.774-48.945 0-88.624 36.611-88.624 81.774v436.13c0 45.163 39.679 81.775 88.624 81.775 48.946 0 88.624-36.612 88.624-81.775V81.816ZM583.379 81.816c0-45.163-39.678-81.774-88.624-81.774-48.945 0-88.624 36.611-88.624 81.774v436.13c0 45.163 39.679 81.775 88.624 81.775 48.946 0 88.624-36.612 88.624-81.775V81.816Z"></path><path d="M935.39 132.185c30.161-35.57 23.362-86.965-15.187-114.795S825.954-4.165 795.794 31.404L425.713 467.848c-30.161 35.57-23.361 86.965 15.187 114.795 38.549 27.829 94.249 21.555 124.41-14.014l370.08-436.444ZM564.288 132.196c30.161-35.569 23.362-86.964-15.187-114.794S454.852-4.154 424.692 31.416L54.611 467.86c-30.16 35.569-23.361 86.965 15.187 114.794 38.549 27.83 94.249 21.556 124.41-14.013l370.08-436.445Z"></path></g></svg>
|
|
160
|
+
<script>
|
|
161
|
+
document.querySelectorAll('.folder.nested').forEach(folder => {
|
|
162
|
+
folder.addEventListener('click', function() {
|
|
163
|
+
let nextElement = this.nextElementSibling;
|
|
164
|
+
while (nextElement && nextElement.classList.contains('file') && nextElement.classList.contains('nested')) {
|
|
165
|
+
nextElement.classList.toggle('collapsed');
|
|
166
|
+
nextElement = nextElement.nextElementSibling;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
</script>
|
|
146
171
|
</body>
|
|
147
172
|
</html>
|
|
@@ -3,17 +3,26 @@ import { defu as merge } from 'defu'
|
|
|
3
3
|
import md from 'posthtml-markdownit'
|
|
4
4
|
import posthtmlConfig from '../posthtml/defaultConfig.js'
|
|
5
5
|
|
|
6
|
-
export async function markdown(
|
|
6
|
+
export async function markdown(input = '', options = {}, posthtmlOptions = {}) {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
|
|
8
|
+
* If no input is provided, return an empty string.
|
|
9
|
+
*/
|
|
10
|
+
if (!input) {
|
|
11
|
+
return ''
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Automatically wrap in <md> tag, unless manual mode is enabled.
|
|
16
|
+
*
|
|
17
|
+
* With manual mode, user must wrap the input in a <md> tag.
|
|
18
|
+
*
|
|
10
19
|
* https://github.com/posthtml/posthtml-markdownit#usage
|
|
11
20
|
*/
|
|
12
|
-
|
|
21
|
+
input = options.manual ? input : `<md>${input}</md>`
|
|
13
22
|
|
|
14
23
|
return posthtml([
|
|
15
24
|
md(options)
|
|
16
25
|
])
|
|
17
|
-
.process(
|
|
26
|
+
.process(input, merge(posthtmlOptions, posthtmlConfig))
|
|
18
27
|
.then(result => result.html)
|
|
19
28
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -37,10 +37,11 @@ declare namespace MaizzleFramework {
|
|
|
37
37
|
*
|
|
38
38
|
* @param {string} input The Markdown string to compile.
|
|
39
39
|
* @param {MarkdownConfig} [options] A configuration object for the Markdown compiler.
|
|
40
|
-
* @
|
|
41
|
-
* @
|
|
40
|
+
* @param {PostHTMLConfig} [posthtmlOptions] A configuration object for PostHTML.
|
|
41
|
+
* @returns {Promise<string>} The compiled HTML string.
|
|
42
|
+
* @see https://maizzle.com/docs/markdown#api
|
|
42
43
|
*/
|
|
43
|
-
function markdown(input: string, options?: MarkdownConfig): string
|
|
44
|
+
function markdown(input: string, options?: MarkdownConfig, posthtmlOptions?: PostHTMLConfig): Promise<string>;
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Prevent widow words inside a tag by adding a ` ` between its last two words.
|