@tenjuu99/blog 0.2.20 → 0.2.22

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.
@@ -4,7 +4,7 @@ import { staticFile } from './files.js'
4
4
 
5
5
  const alreadyLoaded = {}
6
6
 
7
- const includeRegexp = new RegExp(/\{\s*include\('(template|css)\/([\w\-\_\./]+)'\)\s*\}/g)
7
+ const includeRegexp = new RegExp(/\{\s*include\('(template|css)\/([\w\./-]+)'\)\s*\}/g)
8
8
 
9
9
  const includeFilter = (text) => {
10
10
  let replaced = text
@@ -23,6 +23,9 @@ const includeFilter = (text) => {
23
23
  if (typeof content === 'undefined') {
24
24
  throw new Error(cacheKey + ' is not found')
25
25
  }
26
+ if (content instanceof Promise) {
27
+ throw new Error(cacheKey + ' is invalid')
28
+ }
26
29
  // include を再帰的に解決する
27
30
  if (content.match(includeRegexp)) {
28
31
  content = includeFilter(content)
package/lib/render.js CHANGED
@@ -7,6 +7,11 @@ import includeFilter from './includeFilter.js'
7
7
  import { marked } from "marked";
8
8
  import { applyTemplate } from './applyTemplate.js'
9
9
 
10
+ marked.use({
11
+ gfm: true,
12
+ breaks: true
13
+ })
14
+
10
15
  const render = async (templateName, data) => {
11
16
  let template = await applyTemplate(templateName)
12
17
  template = replaceIfFilter(template, data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenjuu99/blog",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "blog template",
5
5
  "main": "index.js",
6
6
  "scripts": {