@kolkrabbi/kol-workshop 0.1.1 → 0.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-workshop",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "description": "KOL workshop/docs system — a handrolled markdown engine, search, tag system (incl. a d3 tag graph), docs viewer, and docs shell. Sits above @kolkrabbi/kol-{theme,icons,component,framework}; content is consumer-injected (the package never globs docs).",
6
6
  "license": "MIT",
@@ -13,10 +13,10 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "d3": "^7.9.0",
16
+ "@kolkrabbi/kol-brand": "^0.1.2",
16
17
  "@kolkrabbi/kol-component": "0.7.0",
17
- "@kolkrabbi/kol-brand": "0.1.0",
18
- "@kolkrabbi/kol-icons": "0.5.0",
19
18
  "@kolkrabbi/kol-theme": "0.7.1",
19
+ "@kolkrabbi/kol-icons": "0.5.0",
20
20
  "@kolkrabbi/kol-framework": "0.3.2"
21
21
  },
22
22
  "peerDependencies": {
@@ -36,6 +36,20 @@ const processInlineMarkdown = (text) => {
36
36
  continue
37
37
  }
38
38
 
39
+ // Wikilink: [[target]] / [[target|display]] / [[target#anchor|display]] (Obsidian).
40
+ // Emitted as a .md link so it routes through the same resolveDocLink cross-link path.
41
+ const wikiMatch = remaining.match(/^\[\[([^\]|#]+)(?:#([^\]|]+))?(?:\|([^\]]+))?\]\]/)
42
+ if (wikiMatch) {
43
+ const target = wikiMatch[1].trim().replace(/\.md$/, '')
44
+ const anchor = wikiMatch[2]
45
+ ? wikiMatch[2].trim().toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '')
46
+ : ''
47
+ const display = wikiMatch[3] ? wikiMatch[3].trim() : (wikiMatch[1].trim().split('/').pop())
48
+ tokens.push({ type: 'link', text: display, url: `${target}.md${anchor ? `#${anchor}` : ''}` })
49
+ remaining = remaining.slice(wikiMatch[0].length)
50
+ continue
51
+ }
52
+
39
53
  // Link: [text](url)
40
54
  const linkMatch = remaining.match(/^\[([^\]]+)\]\(([^)]+)\)/)
41
55
  if (linkMatch) {
@@ -67,14 +67,14 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
67
67
  <div className="space-y-4">
68
68
  <div className="shell-sidebar-toggle shell-sidebar-label" style={{ justifyContent: 'space-between', paddingRight: '4px' }}>
69
69
  {labelTo ? (
70
- <Link to={labelTo} className="shell-sidebar-label" onClick={(e) => {
70
+ <Link to={labelTo} className="shell-sidebar-label kol-helper-14" onClick={(e) => {
71
71
  if (navCollapsed && handleToggle) handleToggle()
72
72
  if (onNavigate) onNavigate(e)
73
73
  }}>
74
74
  {label}
75
75
  </Link>
76
76
  ) : (
77
- <button type="button" onClick={handleToggle}>{label}</button>
77
+ <button type="button" className="kol-helper-14" onClick={handleToggle}>{label}</button>
78
78
  )}
79
79
  <button
80
80
  type="button"
@@ -99,7 +99,7 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
99
99
  <div key={route.id} className="shell-nav-group">
100
100
  <button
101
101
  type="button"
102
- className="shell-nav-group-header w-full text-left"
102
+ className="shell-nav-group-header w-full text-left kol-helper-14"
103
103
  onClick={() => handleSectionClick(route)}
104
104
  >
105
105
  <span className="flex items-center gap-2">
@@ -111,7 +111,7 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
111
111
  {route.label}
112
112
  </span>
113
113
  {route.children?.length > 0 && (
114
- <span className="shell-nav-group-count">({route.children.length})</span>
114
+ <span className="shell-nav-group-count kol-helper-14">({route.children.length})</span>
115
115
  )}
116
116
  </button>
117
117
 
@@ -129,7 +129,7 @@ const ShellSidebar = ({ routes = [], basePath = '/', onNavigate, label = 'Naviga
129
129
  }
130
130
  onClick={onNavigate}
131
131
  >
132
- <span className="shell-nav-item-title">{child.label}</span>
132
+ <span className="shell-nav-item-title kol-helper-14">{child.label}</span>
133
133
  </NavLink>
134
134
  )
135
135
  })}
@@ -96,10 +96,26 @@ export const TagModeProvider = ({
96
96
  )
97
97
  }
98
98
 
99
- export const useTagMode = () => {
100
- const ctx = useContext(TagModeContext)
101
- if (!ctx) throw new Error('useTagMode must be used within TagModeProvider')
102
- return ctx
99
+ /**
100
+ * No-provider fallback: tag mode degrades to inert (tags render, clicks no-op)
101
+ * instead of crashing the reader. Wrap with TagModeProvider to enable it.
102
+ */
103
+ const noop = () => {}
104
+ const DEFAULT_TAG_MODE = {
105
+ isOpen: false,
106
+ activeTags: [],
107
+ activeTag: null,
108
+ openTagMode: noop,
109
+ closeTagMode: noop,
110
+ toggleTag: noop,
111
+ removeTag: noop,
112
+ clearTags: noop,
113
+ setActiveTag: noop,
114
+ inventory: [],
115
+ docHref: defaultDocHref,
116
+ tagHref: defaultTagHref
103
117
  }
104
118
 
119
+ export const useTagMode = () => useContext(TagModeContext) ?? DEFAULT_TAG_MODE
120
+
105
121
  export default TagModeContext