vowel 0.6.1 → 0.6.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/README.md CHANGED
@@ -12,7 +12,7 @@ See the docs: [vowel.cc](https://vowel.cc).
12
12
  ### Launch checklist
13
13
 
14
14
  - [x] CLI
15
- - [ ] Docs
15
+ - [x] Docs
16
16
  - [x] Classes
17
17
  - [x] Route patterns
18
18
  - [x] Post list metadata
@@ -40,9 +40,9 @@ See the docs: [vowel.cc](https://vowel.cc).
40
40
  - [x] Robots.txt
41
41
  - [x] Sitemap.xml
42
42
  - [x] RSS
43
- - [x] 404.html (just make 404.md)
43
+ - [ ] 404.html (just make 404.md)
44
44
  - [ ] Markup
45
- - [.] Image as figure
45
+ - [x] Image as figure
46
46
  - [x] Admonitions
47
47
  - [x] Heading anchors
48
48
  - [ ] GFM emoji
@@ -54,7 +54,7 @@ See the docs: [vowel.cc](https://vowel.cc).
54
54
  - [x] Prune/cleanup step
55
55
  - [ ] Dependency type (file, settings, folder)
56
56
  - [ ] New systems
57
- - [ ] Tags
57
+ - [x] Tags
58
58
  - [ ] External links
59
59
  - [ ] Syntax highlighting
60
60
  - [ ] Social links
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vowel",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.6.3",
5
5
  "bin": "bin.js",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -100,7 +100,6 @@ function createDynamicImage(imagePath, database, dependent, alt, itemprop) {
100
100
 
101
101
  const relativePath = imagePath.startsWith("/") ? path.relative("/", imagePath) : imagePath
102
102
  const image = database.target.getWithTrackers(relativePath, dependent)
103
- console.log({ image, relativePath })
104
103
  if (!image) return
105
104
  const formats = createImagePaths(image.abstract.sourcePath, "./", image.abstract.uuid)
106
105
 
@@ -919,15 +918,16 @@ function writeFile(destination, database, config) {
919
918
  }
920
919
 
921
920
  function treeNavItems(navItem) {
922
- return h('a', {
921
+ return h('li', h('a', {
923
922
  href: navItem.metadata.prettyURL,
924
923
  "aria-current": metadata.prettyURL === navItem.metadata.prettyURL ? 'page' : null
925
- }, navItem.metadata.breadcrumb)
924
+ }, navItem.metadata.breadcrumb))
926
925
  }
927
926
 
928
927
  function navItemFilter(nav_item) {
929
928
  return !nav_item.metadata.date
930
929
  && nav_item.path !== "index.html"
930
+ && nav_item.path !== "404.html"
931
931
  && nav_item.syntax === ".html"
932
932
  && nav_item.path
933
933
  }
@@ -946,16 +946,17 @@ function writeFile(destination, database, config) {
946
946
  .filter(navItemFilter)
947
947
  .toSorted(sort_items)
948
948
 
949
- return h('nav', sorted.map(treeNavItems))
949
+ return h('ul', sorted.map(treeNavItems))
950
950
  }
951
951
 
952
952
 
953
953
  const groupedNavs = Object.groupBy(family, ({ dir }) => dir)
954
954
 
955
- const treeNav = Object.entries(groupedNavs)
955
+ const treeNav = h('nav', Object.entries(groupedNavs)
956
956
  .sort(([a], [b]) => a.length - b.length)
957
957
  .map(([k, v]) => treeNavFolder(v))
958
958
  .filter(folder => folder.children.length)
959
+ )
959
960
 
960
961
  let treeBreadcrumbs = []
961
962
 
@@ -987,13 +988,14 @@ function writeFile(destination, database, config) {
987
988
  // TODO better color handling https://antfu.me/posts/icons-in-pure-css
988
989
  if (settings.fm_logo && settings.fm_logo[""]) {
989
990
  headerElements.push(
990
- h('a.logo', {
991
+ h('a#logo', {
991
992
  href: "/",
992
- alt: "",
993
+ "aria-label": "logo",
993
994
  rel: "home",
994
- "style": `mask-image: url("/${settings.fm_logo[""]}")`
995
+ "style": `--logo-url: url("/${settings.fm_logo[""]}")`
995
996
  }, h("img", {
996
- src: "/" + settings.fm_logo[""]
997
+ src: "/" + settings.fm_logo[""],
998
+ alt: ""
997
999
  }))
998
1000
  )
999
1001
  /*
@@ -1004,7 +1006,7 @@ function writeFile(destination, database, config) {
1004
1006
  // FIXME aspect ratio
1005
1007
  headerElements.push(
1006
1008
  h('a.logo', {
1007
- style: `background-color: currentColor; mask-image: url('${(new URL(settings.fm_logo[""], "thismessage://")).pathname}'); mask-size: 100% 100%;`,
1009
+ style: `background-color: currentColor; --logo-url: url('${(new URL(settings.fm_logo[""], "thismessage://")).pathname}'); mask-size: 100% 100%;`,
1008
1010
  href: "/",
1009
1011
  rel: "home",
1010
1012
  alt: ""
@@ -1025,7 +1027,7 @@ function writeFile(destination, database, config) {
1025
1027
  }
1026
1028
 
1027
1029
  if (settings.fm_wordmark && settings.fm_wordmark[""]) {
1028
- headerElements.push(h("a.wordmark", {
1030
+ headerElements.push(h("a#wordmark", {
1029
1031
  href: "/",
1030
1032
  rel: "home"
1031
1033
  }, h("img", {
@@ -1034,16 +1036,16 @@ function writeFile(destination, database, config) {
1034
1036
  }
1035
1037
 
1036
1038
  if (settings.title && settings.title[""]) {
1037
- headerElements.push(h('a.title', { href: "/", rel: "home" }, settings.title[""]))
1039
+ headerElements.push(h('a#title', { href: "/", rel: "home" }, settings.title[""]))
1038
1040
  }
1039
1041
 
1040
1042
  if (settings.fm_tagline && settings.fm_tagline[""]) {
1041
- headerElements.push(h('p.tagline', settings.fm_tagline[""][0]))
1043
+ headerElements.push(h('p#tagline', settings.fm_tagline[""][0]))
1042
1044
  }
1043
1045
 
1044
1046
  const treeHeader = h('header', [
1045
1047
  ...headerElements,
1046
- ...treeNav,
1048
+ treeNav
1047
1049
  ])
1048
1050
 
1049
1051
  const treeContent = toHast(abstract)
@@ -1068,11 +1070,24 @@ function writeFile(destination, database, config) {
1068
1070
 
1069
1071
  const treeContentSlugged = slugger.runSync(treeContent)
1070
1072
 
1073
+ const treeTableOfContents = treeContentSlugged.children.shift()
1074
+
1071
1075
  const treeMainHead = makeHead(metadata, null, database, config)
1072
1076
 
1077
+ treeMainHead.push(treeTableOfContents)
1078
+
1073
1079
  visit(treeContent, { tagName: "img" }, (node, index, parent) => {
1074
1080
  const { src, alt } = node.properties
1075
- parent.children.splice(index, 1, createDynamicImage(src, database, destination.path, alt))
1081
+ const image = createDynamicImage(src, database, destination.path.path, alt)
1082
+ if (index === 0 && parent.children.length > 1) {
1083
+ console.log(parent.children)
1084
+ const [_, ...caption] = parent.children
1085
+ parent.children = [
1086
+ h("figure", [image, h("figcaption", caption)])
1087
+ ]
1088
+ } else {
1089
+ parent.children.splice(index, 1, image)
1090
+ }
1076
1091
  })
1077
1092
 
1078
1093
  visit(treeContent, testPaths, ({ children: [child] }, i, p) => {
@@ -1164,7 +1179,7 @@ function writeFile(destination, database, config) {
1164
1179
  'aria-label': 'Breadcrumbs'
1165
1180
  }, treeBreadcrumbs),
1166
1181
  treeMainHead,
1167
- treeContent
1182
+ h('section#content', treeContent)
1168
1183
  ])
1169
1184
 
1170
1185
  visit(treeMain, (node, index, parent) => {
@@ -1227,6 +1242,7 @@ function writeFile(destination, database, config) {
1227
1242
  const globalNavItems = everything.filter(item => {
1228
1243
  return item.dir === ""
1229
1244
  && item.path !== "index.html"
1245
+ && item.path !== "404.html"
1230
1246
  && item.path !== "tags.html"
1231
1247
  })
1232
1248
  .map(getChildren)
@@ -1279,8 +1295,8 @@ function writeFile(destination, database, config) {
1279
1295
  const treeAside = h('aside', treeGlobalNav)
1280
1296
 
1281
1297
  const treeFooter = h('footer', [
1282
- h('section.copyright', `© ${new Date().getFullYear()}`),
1283
- h('section.shoutout', [
1298
+ h('section#copyright', `© ${new Date().getFullYear()}`),
1299
+ h('section#shoutout', [
1284
1300
  "Made with ",
1285
1301
  h('a', {
1286
1302
  href: "https://vowel.cc"