orga-build 0.7.0 → 0.7.1

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.
@@ -40,6 +40,8 @@ This is a test page.
40
40
  Here's [[file:./docs/index.org][index page]].
41
41
 
42
42
  Here's [[file:more.org][another page]].
43
+
44
+ Here's [[mailto:hi@unclex.net][send me an email]].
43
45
  `
44
46
  )
45
47
  await fs.writeFile(
@@ -85,6 +87,10 @@ Here's [[file:more.org][another page]].
85
87
  'should rewrite docs/index.org to /docs'
86
88
  )
87
89
  assert.ok(html.includes('href="/more"'), 'should rewrite more.org to /more')
90
+ assert.ok(
91
+ html.includes('href="mailto:hi@unclex.net"'),
92
+ 'should keep mailto protocol in href'
93
+ )
88
94
  })
89
95
 
90
96
  test('generates assets directory', async () => {
package/lib/app.jsx CHANGED
@@ -3,6 +3,13 @@ import * as components from '/@orga-build/components'
3
3
  import layouts from '/@orga-build/layouts'
4
4
  import pages from '/@orga-build/pages'
5
5
 
6
+ function SmartLink({ href, ...props }) {
7
+ if (!href || /^([a-z][a-z\d+\-.]*:|\/\/)/i.test(href)) {
8
+ return <a href={href} {...props} />
9
+ }
10
+ return <Link href={href} {...props} />
11
+ }
12
+
6
13
  export function App() {
7
14
  const _pages = Object.entries(pages).map(([path, page]) => {
8
15
  return {
@@ -16,7 +23,10 @@ export function App() {
16
23
  .filter((key) => path.startsWith(key))
17
24
  .sort((a, b) => -a.localeCompare(b))
18
25
  let element = (
19
- <page.default key={path} components={{ ...components, Link, a: Link }} />
26
+ <page.default
27
+ key={path}
28
+ components={{ ...components, Link, a: SmartLink }}
29
+ />
20
30
  )
21
31
  for (const layoutId of layoutIds) {
22
32
  const Layout = layouts[layoutId]
package/lib/orga.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"orga.d.ts","sourceRoot":"","sources":["orga.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,mEAJG;IAAiC,cAAc,EAAvC,MAAM,GAAC,MAAM,EAAE;IACC,IAAI,EAApB,MAAM;IACoC,aAAa;CACjE,mCAaA"}
1
+ {"version":3,"file":"orga.d.ts","sourceRoot":"","sources":["orga.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,mEAJG;IAAiC,cAAc,EAAvC,MAAM,GAAC,MAAM,EAAE;IACC,IAAI,EAApB,MAAM;IACoC,aAAa;CACjE,mCAUA"}
package/lib/orga.js CHANGED
@@ -19,10 +19,7 @@ export function setupOrga({ containerClass, root, rehypePlugins = [] }) {
19
19
  [rewriteOrgFileLinks, { root }],
20
20
  mediaAssets,
21
21
  ...rehypePlugins
22
- ],
23
- reorgRehypeOptions: {
24
- linkHref: (link) => link.path.value
25
- }
22
+ ]
26
23
  })
27
24
  }
28
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orga-build",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "A simple tool that builds org-mode files into a website",
5
5
  "type": "module",
6
6
  "engines": {