@brillout/docpress 0.10.5 → 0.10.6
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/Layout.tsx +7 -4
- package/MenuModal/Collapsible.css +9 -5
- package/MenuModal/NavigationWithColumnLayout.css +1 -0
- package/MenuModal/NavigationWithColumnLayout.tsx +12 -5
- package/MenuModal/toggleMenuModal.ts +34 -48
- package/MenuModal.tsx +17 -30
- package/NavItemComponent.css +29 -12
- package/NavItemComponent.tsx +3 -3
- package/components/Link.tsx +5 -5
- package/config/resolveHeadingsData.ts +2 -2
- package/dist/NavItemComponent.js +3 -3
- package/dist/components/Link.js +5 -5
- package/dist/config/resolveHeadingsData.js +2 -2
- package/dist/parseMarkdownMini.d.ts +2 -0
- package/dist/{parseTitle.js → parseMarkdownMini.js} +5 -12
- package/dist/parsePageSections.js +2 -2
- package/dist/utils/Emoji/Emoji.js +1 -0
- package/icons/scroll.svg +31 -39
- package/index.ts +1 -0
- package/package.json +1 -1
- package/{parseTitle.ts → parseMarkdownMini.ts} +5 -19
- package/parsePageSections.ts +2 -2
- package/utils/Emoji/Emoji.ts +2 -0
- package/dist/parseTitle.d.ts +0 -5
package/Layout.tsx
CHANGED
|
@@ -9,10 +9,10 @@ export { blockMargin }
|
|
|
9
9
|
|
|
10
10
|
import React from 'react'
|
|
11
11
|
import { getNavItemsWithComputed, NavItem, NavItemComponent } from './NavItemComponent'
|
|
12
|
-
import {
|
|
12
|
+
import { parseMarkdownMini } from './parseMarkdownMini'
|
|
13
13
|
import { usePageContext, usePageContext2 } from './renderer/usePageContext'
|
|
14
14
|
import { NavSecondaryContent } from './NavSecondaryContent'
|
|
15
|
-
import {
|
|
15
|
+
import { coseMenuModalOnMouseLeave, openMenuModal, toggleMenuModal } from './MenuModal/toggleMenuModal'
|
|
16
16
|
import { MenuModal } from './MenuModal'
|
|
17
17
|
import { autoScrollNav_SSR } from './autoScrollNav'
|
|
18
18
|
import { SearchLink } from './docsearch/SearchLink'
|
|
@@ -154,7 +154,7 @@ function LayoutLandingPage({ children }: { children: React.ReactNode }) {
|
|
|
154
154
|
function PageContent({ children }: { children: React.ReactNode }) {
|
|
155
155
|
const pageContext = usePageContext()
|
|
156
156
|
const { isLandingPage, pageTitle } = pageContext
|
|
157
|
-
const pageTitleParsed = pageTitle &&
|
|
157
|
+
const pageTitleParsed = pageTitle && parseMarkdownMini(pageTitle)
|
|
158
158
|
const { globalNote } = pageContext.config
|
|
159
159
|
const ifDocPage = (style: React.CSSProperties) => (isLandingPage ? {} : style)
|
|
160
160
|
return (
|
|
@@ -560,7 +560,7 @@ function MenuToggle({ menuId, ...props }: PropsDiv & { menuId: number }) {
|
|
|
560
560
|
}}
|
|
561
561
|
onMouseLeave={() => {
|
|
562
562
|
if (onMouseIgnore) return
|
|
563
|
-
|
|
563
|
+
coseMenuModalOnMouseLeave(menuId)
|
|
564
564
|
}}
|
|
565
565
|
onTouchStart={() => {
|
|
566
566
|
onMouseIgnore = setTimeout(() => {
|
|
@@ -583,6 +583,9 @@ function MenuToggle({ menuId, ...props }: PropsDiv & { menuId: number }) {
|
|
|
583
583
|
.link-hover-animation &:hover::before {
|
|
584
584
|
top: 0;
|
|
585
585
|
}
|
|
586
|
+
html.menu-modal-show & {
|
|
587
|
+
cursor: default !important;
|
|
588
|
+
}
|
|
586
589
|
}
|
|
587
590
|
&::before {
|
|
588
591
|
position: absolute;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
.collapsible-icon {
|
|
2
2
|
display: none;
|
|
3
3
|
position: absolute;
|
|
4
|
-
|
|
4
|
+
right: -16px;
|
|
5
|
+
top: calc(100% / 2 - 5px);
|
|
5
6
|
margin-left: 9px;
|
|
6
7
|
vertical-align: middle;
|
|
7
8
|
}
|
|
8
9
|
:has(> .collapsible-icon) {
|
|
9
10
|
position: relative;
|
|
11
|
+
overflow: visible;
|
|
10
12
|
}
|
|
11
|
-
.collapsible-expanded
|
|
12
|
-
.collapsible-collapsed
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
.collapsible-expanded,
|
|
14
|
+
.collapsible-collapsed {
|
|
15
|
+
.collapsible-icon {
|
|
16
|
+
transition: transform 0.3s ease-in-out !important;
|
|
17
|
+
display: initial;
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
.collapsible-collapsed .collapsible-icon {
|
|
17
21
|
transform: rotate(-90deg);
|
|
@@ -26,7 +26,11 @@ function NavigationWithColumnLayout(props: { navItems: NavItem[] }) {
|
|
|
26
26
|
return (
|
|
27
27
|
<>
|
|
28
28
|
<Style>{getStyle()}</Style>
|
|
29
|
-
<div
|
|
29
|
+
<div
|
|
30
|
+
id="menu-navigation-container"
|
|
31
|
+
className="navigation-content add-transition"
|
|
32
|
+
style={{ transitionProperty: 'height', height: 0 }}
|
|
33
|
+
>
|
|
30
34
|
{navItemsByColumnLayouts.map((columnLayout, i) => (
|
|
31
35
|
<div
|
|
32
36
|
id={`menu-navigation-${i}`}
|
|
@@ -94,6 +98,10 @@ function NavigationWithColumnLayout(props: { navItems: NavItem[] }) {
|
|
|
94
98
|
position: absolute;
|
|
95
99
|
width: 100%;
|
|
96
100
|
}
|
|
101
|
+
#menu-navigation-container {
|
|
102
|
+
position: relative;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
97
105
|
${navItemsByColumnLayouts
|
|
98
106
|
.map((_, i) => {
|
|
99
107
|
const isFirst = i === 0
|
|
@@ -112,10 +120,11 @@ function NavigationWithColumnLayout(props: { navItems: NavItem[] }) {
|
|
|
112
120
|
${/* Performance optimization. */ ''}
|
|
113
121
|
${/* - Using clip-path transition instead of height transition doesn't make a difference: https://github.com/brillout/docpress/commit/005cba0b4cba9c1b526e8e26901ee04129d79715 */ ''}
|
|
114
122
|
${/* - Suprisingly, this is a performance regression when transitioning from one menu to another (the menu is kept open). Thus we apply this only when the menu is being closed/opened. */ ''}
|
|
115
|
-
html:not(.menu-modal-show-${i}).menu-modal-
|
|
123
|
+
html:not(.menu-modal-show-${i}).menu-modal-display-only-one & {
|
|
116
124
|
display: none;
|
|
117
125
|
}
|
|
118
126
|
}
|
|
127
|
+
${/* Button style */ ''}
|
|
119
128
|
.menu-toggle-${i} {
|
|
120
129
|
html.menu-modal-show.menu-modal-show-${i} & {
|
|
121
130
|
color: black !important;
|
|
@@ -127,9 +136,6 @@ function NavigationWithColumnLayout(props: { navItems: NavItem[] }) {
|
|
|
127
136
|
top: 0;
|
|
128
137
|
}
|
|
129
138
|
}
|
|
130
|
-
html.menu-modal-show & {
|
|
131
|
-
cursor: default !important;
|
|
132
|
-
}
|
|
133
139
|
}
|
|
134
140
|
`
|
|
135
141
|
})
|
|
@@ -159,6 +165,7 @@ function ColumnsWrapper({ children, numberOfColumns }: { children: React.ReactNo
|
|
|
159
165
|
style={{
|
|
160
166
|
width: numberOfColumns * (navLeftWidthMax + 20),
|
|
161
167
|
maxWidth: '100%',
|
|
168
|
+
paddingLeft: 3,
|
|
162
169
|
margin: 'auto',
|
|
163
170
|
}}
|
|
164
171
|
>
|
|
@@ -2,10 +2,9 @@ export { toggleMenuModal }
|
|
|
2
2
|
export { openMenuModal }
|
|
3
3
|
export { keepMenuModalOpen }
|
|
4
4
|
export { closeMenuModal }
|
|
5
|
-
export {
|
|
6
|
-
export { addListenerOpenMenuModal }
|
|
5
|
+
export { coseMenuModalOnMouseLeave }
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { containerQueryMobileMenu } from '../Layout'
|
|
9
8
|
import { getHydrationPromise } from '../renderer/getHydrationPromise'
|
|
10
9
|
import { getViewportWidth } from '../utils/getViewportWidth'
|
|
11
10
|
import { isBrowser } from '../utils/isBrowser'
|
|
@@ -19,20 +18,23 @@ function openMenuModal(menuNavigationId: number) {
|
|
|
19
18
|
open(menuNavigationId)
|
|
20
19
|
}
|
|
21
20
|
async function open(menuNavigationId?: number) {
|
|
22
|
-
if (
|
|
21
|
+
if (toggleLock) {
|
|
23
22
|
if (menuNavigationId === undefined) {
|
|
24
|
-
clearTimeout(
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
clearTimeout(toggleLock?.timeoutAction)
|
|
24
|
+
toggleLock = undefined
|
|
25
|
+
} else {
|
|
26
|
+
// Register open() operation to be applied later, after the lock has resolved.
|
|
27
|
+
toggleLock.idToOpen = menuNavigationId
|
|
27
28
|
}
|
|
28
|
-
menuModalLock.idNext = menuNavigationId
|
|
29
29
|
return
|
|
30
30
|
}
|
|
31
31
|
const { classList } = document.documentElement
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (classList.contains('menu-modal-display-only-one')) {
|
|
33
|
+
classList.remove('menu-modal-display-only-one')
|
|
34
|
+
} else if (!classList.contains('menu-modal-show')) {
|
|
35
|
+
enableDisplayOnlyOne()
|
|
35
36
|
}
|
|
37
|
+
classList.add('menu-modal-show')
|
|
36
38
|
if (menuNavigationId !== undefined) {
|
|
37
39
|
const currentModalId = getCurrentMenuId()
|
|
38
40
|
if (currentModalId === menuNavigationId) return
|
|
@@ -45,65 +47,49 @@ async function open(menuNavigationId?: number) {
|
|
|
45
47
|
const height = window.getComputedStyle(document.getElementById(`menu-navigation-${menuNavigationId}`)!).height
|
|
46
48
|
document.getElementById('menu-navigation-container')!.style.height = height
|
|
47
49
|
}
|
|
48
|
-
listener?.()
|
|
49
|
-
}
|
|
50
|
-
let listener: () => void | undefined
|
|
51
|
-
function addListenerOpenMenuModal(cb: () => void) {
|
|
52
|
-
listener = cb
|
|
53
50
|
}
|
|
54
51
|
function closeMenuModal() {
|
|
55
52
|
const { classList } = document.documentElement
|
|
56
53
|
if (classList.contains('menu-modal-show')) {
|
|
57
|
-
|
|
58
|
-
// Remove:
|
|
59
|
-
// menu-modal-show-0
|
|
60
|
-
// menu-modal-show-1
|
|
61
|
-
// ...
|
|
62
|
-
classList.forEach((className) => {
|
|
63
|
-
if (className.startsWith('menu-modal-show-')) {
|
|
64
|
-
classList.remove(className)
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
})
|
|
54
|
+
enableDisplayOnlyOne()
|
|
68
55
|
classList.remove('menu-modal-show')
|
|
69
56
|
}
|
|
70
57
|
}
|
|
71
58
|
let timeoutModalAnimation: NodeJS.Timeout | undefined
|
|
72
|
-
function
|
|
59
|
+
function enableDisplayOnlyOne() {
|
|
73
60
|
const { classList } = document.documentElement
|
|
74
|
-
classList.add('menu-modal-
|
|
61
|
+
classList.add('menu-modal-display-only-one')
|
|
75
62
|
clearTimeout(timeoutModalAnimation)
|
|
76
63
|
timeoutModalAnimation = setTimeout(() => {
|
|
77
|
-
classList.remove('menu-modal-
|
|
78
|
-
|
|
79
|
-
}, 450)
|
|
64
|
+
classList.remove('menu-modal-display-only-one')
|
|
65
|
+
}, 430)
|
|
80
66
|
}
|
|
81
67
|
|
|
82
|
-
let
|
|
68
|
+
let toggleLock:
|
|
83
69
|
| {
|
|
84
70
|
idCurrent: number
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
idToOpen: number | undefined
|
|
72
|
+
timeoutAction: NodeJS.Timeout
|
|
87
73
|
}
|
|
88
74
|
| undefined
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
75
|
+
function coseMenuModalOnMouseLeave(menuId: number) {
|
|
76
|
+
clearTimeout(toggleLock?.timeoutAction)
|
|
77
|
+
const timeoutAction = setTimeout(action, 100)
|
|
78
|
+
toggleLock = {
|
|
79
|
+
idCurrent: menuId,
|
|
80
|
+
idToOpen: undefined,
|
|
81
|
+
timeoutAction,
|
|
82
|
+
}
|
|
83
|
+
return
|
|
84
|
+
function action() {
|
|
85
|
+
const { idCurrent, idToOpen: idNext } = toggleLock!
|
|
86
|
+
toggleLock = undefined
|
|
95
87
|
if (idNext === idCurrent) return
|
|
96
88
|
if (idNext === undefined) {
|
|
97
89
|
closeMenuModal()
|
|
98
90
|
} else {
|
|
99
91
|
openMenuModal(idNext)
|
|
100
92
|
}
|
|
101
|
-
}, 100)
|
|
102
|
-
clearTimeout(menuModalLock?.timeout)
|
|
103
|
-
menuModalLock = {
|
|
104
|
-
idCurrent: currentModalId,
|
|
105
|
-
idNext: undefined,
|
|
106
|
-
timeout,
|
|
107
93
|
}
|
|
108
94
|
}
|
|
109
95
|
function getCurrentMenuId(): null | number {
|
|
@@ -125,7 +111,7 @@ function toggleMenuModal(menuId: number) {
|
|
|
125
111
|
closeMenuModal()
|
|
126
112
|
} else {
|
|
127
113
|
openMenuModal(menuId)
|
|
128
|
-
if (getViewportWidth() <
|
|
114
|
+
if (getViewportWidth() < containerQueryMobileMenu) autoScroll()
|
|
129
115
|
}
|
|
130
116
|
}
|
|
131
117
|
|
package/MenuModal.tsx
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
export { MenuModal }
|
|
2
2
|
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react'
|
|
4
4
|
import { usePageContext } from './renderer/usePageContext'
|
|
5
5
|
import { css } from './utils/css'
|
|
6
|
-
import {
|
|
6
|
+
import { containerQueryMobileLayout, containerQueryMobileMenu } from './Layout'
|
|
7
7
|
import { NavSecondaryContent } from './NavSecondaryContent'
|
|
8
8
|
import { Style } from './utils/Style'
|
|
9
9
|
import { NavigationWithColumnLayout } from './MenuModal/NavigationWithColumnLayout'
|
|
10
|
-
import {
|
|
10
|
+
import { closeMenuModal, keepMenuModalOpen } from './MenuModal/toggleMenuModal'
|
|
11
11
|
|
|
12
12
|
function MenuModal({ isTopNav }: { isTopNav: boolean }) {
|
|
13
|
-
// `transition: height` doesn't work on `height: auto` => we have to manually set and change `height` to a fixed size.
|
|
14
|
-
const [height, setHeight] = useState(0)
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
addListenerOpenMenuModal(() => {
|
|
17
|
-
const { scrollHeight } = document.getElementById('menu-modal-scroll-container')!
|
|
18
|
-
const heightNew = scrollHeight + blockMargin
|
|
19
|
-
if (height !== heightNew) setHeight(heightNew)
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
13
|
return (
|
|
23
14
|
<>
|
|
24
15
|
<Style>{getStyle()}</Style>
|
|
@@ -32,10 +23,8 @@ function MenuModal({ isTopNav }: { isTopNav: boolean }) {
|
|
|
32
23
|
left: 0,
|
|
33
24
|
zIndex: 199, // maximum value, because docsearch's modal has `z-index: 200`
|
|
34
25
|
background: '#ededef',
|
|
35
|
-
transitionProperty: '
|
|
26
|
+
transitionProperty: 'opacity',
|
|
36
27
|
transitionTimingFunction: 'ease',
|
|
37
|
-
height,
|
|
38
|
-
overflow: 'hidden',
|
|
39
28
|
}}
|
|
40
29
|
onMouseOver={() => keepMenuModalOpen()}
|
|
41
30
|
onMouseLeave={closeMenuModal}
|
|
@@ -43,9 +32,8 @@ function MenuModal({ isTopNav }: { isTopNav: boolean }) {
|
|
|
43
32
|
<div
|
|
44
33
|
id="menu-modal-scroll-container"
|
|
45
34
|
style={{
|
|
46
|
-
overflowY: 'scroll',
|
|
47
|
-
// Workaround for bug with Firefox 128.1.0
|
|
48
35
|
overflowX: 'hidden',
|
|
36
|
+
overflowY: 'scroll',
|
|
49
37
|
// We don't set `container` to the parent #menu-modal-wrapper beacuse of a Chrome bug (showing a blank <MenuModal>). Edit: IIRC because #menu-modal-wrapper has `position: fixed`.
|
|
50
38
|
container: 'container-viewport / inline-size',
|
|
51
39
|
}}
|
|
@@ -53,8 +41,8 @@ function MenuModal({ isTopNav }: { isTopNav: boolean }) {
|
|
|
53
41
|
<Nav />
|
|
54
42
|
<NavSecondary className="show-only-for-mobile" />
|
|
55
43
|
</div>
|
|
56
|
-
<BorderBottom />
|
|
57
44
|
<CloseButton className="show-only-for-mobile" />
|
|
45
|
+
<BorderBottom />
|
|
58
46
|
</div>
|
|
59
47
|
</>
|
|
60
48
|
)
|
|
@@ -64,11 +52,9 @@ function BorderBottom() {
|
|
|
64
52
|
<div
|
|
65
53
|
id="border-bottom"
|
|
66
54
|
style={{
|
|
67
|
-
position: 'absolute',
|
|
68
55
|
background: '#fff',
|
|
69
56
|
height: 'var(--block-margin)',
|
|
70
57
|
width: '100%',
|
|
71
|
-
bottom: 0,
|
|
72
58
|
}}
|
|
73
59
|
/>
|
|
74
60
|
)
|
|
@@ -96,20 +82,20 @@ function NavSecondary({ className }: { className: string }) {
|
|
|
96
82
|
function getStyle() {
|
|
97
83
|
return css`
|
|
98
84
|
@media(min-width: ${containerQueryMobileMenu + 1}px) {
|
|
99
|
-
#menu-modal-scroll-container,
|
|
100
|
-
#menu-modal-wrapper {
|
|
101
|
-
max-height: calc(100vh - var(--nav-head-height));
|
|
102
|
-
}
|
|
103
85
|
#menu-modal-scroll-container {
|
|
86
|
+
max-height: calc(100vh - var(--nav-head-height) - var(--block-margin));
|
|
104
87
|
${/* https://github.com/brillout/docpress/issues/23 */ ''}
|
|
105
88
|
${/* https://stackoverflow.com/questions/64514118/css-overscroll-behavior-contain-when-target-element-doesnt-overflow */ ''}
|
|
106
89
|
${/* https://stackoverflow.com/questions/9538868/prevent-body-from-scrolling-when-a-modal-is-opened */ ''}
|
|
107
90
|
overscroll-behavior: none;
|
|
108
91
|
}
|
|
109
|
-
html:not(.menu-modal-show)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
92
|
+
html:not(.menu-modal-show) {
|
|
93
|
+
#menu-navigation-container {
|
|
94
|
+
height: 0 !important;
|
|
95
|
+
}
|
|
96
|
+
#menu-modal-wrapper {
|
|
97
|
+
pointer-events: none;
|
|
98
|
+
}
|
|
113
99
|
}
|
|
114
100
|
.show-only-for-mobile {
|
|
115
101
|
display: none !important;
|
|
@@ -142,11 +128,12 @@ function getStyle() {
|
|
|
142
128
|
#menu-modal-wrapper {
|
|
143
129
|
--nav-head-height: 0px !important;
|
|
144
130
|
}
|
|
145
|
-
#menu-modal-wrapper,
|
|
146
131
|
#menu-navigation-container {
|
|
147
|
-
height: auto!important;
|
|
132
|
+
height: auto !important;
|
|
148
133
|
}
|
|
149
134
|
}
|
|
135
|
+
|
|
136
|
+
${/* Hide same-page headings navigation */ ''}
|
|
150
137
|
@container container-viewport (min-width: ${containerQueryMobileLayout}px) {
|
|
151
138
|
#menu-modal-wrapper .nav-item-level-3 {
|
|
152
139
|
display: none;
|
package/NavItemComponent.css
CHANGED
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
letter-spacing: 0.15ch;
|
|
20
20
|
padding-left: var(--padding-left-global);
|
|
21
21
|
padding-right: 4px;
|
|
22
|
-
|
|
23
|
-
.nav-item-level-
|
|
24
|
-
|
|
22
|
+
&:first-child,
|
|
23
|
+
.nav-item-level-1 + & {
|
|
24
|
+
padding-top: 5px;
|
|
25
|
+
}
|
|
25
26
|
}
|
|
26
27
|
.nav-item-level-1 {
|
|
27
28
|
display: inline-flex;
|
|
@@ -30,15 +31,31 @@
|
|
|
30
31
|
font-weight: 600;
|
|
31
32
|
letter-spacing: 0.14ch;
|
|
32
33
|
color: var(--color-text);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
#menu-modal-wrapper & {
|
|
35
|
+
margin-top: 10px;
|
|
36
|
+
padding-left: 9px;
|
|
37
|
+
padding-top: 6px;
|
|
38
|
+
padding-bottom: 6px;
|
|
39
|
+
border-left: 3px solid var(--category-color);
|
|
40
|
+
.collapsible-expanded &,
|
|
41
|
+
.collapsible-collapsed & {
|
|
42
|
+
text-decoration: underline;
|
|
43
|
+
text-decoration-color: var(--category-color);
|
|
44
|
+
text-decoration-thickness: 3px;
|
|
45
|
+
text-underline-offset: .3em;
|
|
46
|
+
border: 0;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 10px;
|
|
49
|
+
padding-left: 14px;
|
|
50
|
+
img {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
#nav-left & {
|
|
56
|
+
border-bottom: 3px solid var(--category-color);
|
|
57
|
+
padding-bottom: 2px;
|
|
58
|
+
margin-top: 3px;
|
|
42
59
|
margin-bottom: 10px;
|
|
43
60
|
}
|
|
44
61
|
}
|
package/NavItemComponent.tsx
CHANGED
|
@@ -7,7 +7,7 @@ export type { ColumnMap }
|
|
|
7
7
|
import React from 'react'
|
|
8
8
|
import { assert, assertWarning, jsxToTextContent } from './utils/server'
|
|
9
9
|
import './NavItemComponent.css'
|
|
10
|
-
import {
|
|
10
|
+
import { parseMarkdownMini } from './parseMarkdownMini'
|
|
11
11
|
import './global.d.ts'
|
|
12
12
|
|
|
13
13
|
type NavItemComputed = ReturnType<typeof getNavItemsWithComputed>[number]
|
|
@@ -36,8 +36,8 @@ function NavItemComponent({
|
|
|
36
36
|
}) {
|
|
37
37
|
assert([1, 2, 3, 4].includes(navItem.level), navItem)
|
|
38
38
|
|
|
39
|
-
const titleJsx =
|
|
40
|
-
const titleInNavJsx =
|
|
39
|
+
const titleJsx = parseMarkdownMini(navItem.title)
|
|
40
|
+
const titleInNavJsx = parseMarkdownMini(navItem.titleInNav)
|
|
41
41
|
|
|
42
42
|
const iconSize = 25
|
|
43
43
|
const icon = navItem.titleIcon && (
|
package/components/Link.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { isRepoLink, RepoLink } from './RepoLink'
|
|
|
6
6
|
import type { PageContextResolved } from '../config/resolvePageContext'
|
|
7
7
|
import { usePageContext } from '../renderer/usePageContext'
|
|
8
8
|
import { assert, assertUsage, determineSectionTitle, determineSectionUrlHash } from '../utils/server'
|
|
9
|
-
import {
|
|
9
|
+
import { parseMarkdownMini } from '../parseMarkdownMini'
|
|
10
10
|
import pc from '@brillout/picocolors'
|
|
11
11
|
|
|
12
12
|
function Link({
|
|
@@ -57,20 +57,20 @@ function getLinkText({
|
|
|
57
57
|
|
|
58
58
|
const breadcrumbParts: JSX.Element[] = []
|
|
59
59
|
if (linkData.linkBreadcrumb) {
|
|
60
|
-
breadcrumbParts.push(...(linkData.linkBreadcrumb ?? []).slice().reverse().map(
|
|
60
|
+
breadcrumbParts.push(...(linkData.linkBreadcrumb ?? []).slice().reverse().map(parseMarkdownMini))
|
|
61
61
|
}
|
|
62
|
-
breadcrumbParts.push(
|
|
62
|
+
breadcrumbParts.push(parseMarkdownMini(linkData.title))
|
|
63
63
|
|
|
64
64
|
if (hrefHash) {
|
|
65
65
|
let sectionTitle: JSX.Element | undefined = undefined
|
|
66
66
|
assert(!hrefHash.startsWith('#'))
|
|
67
67
|
if (isLinkOnSamePage) {
|
|
68
68
|
const linkDataPageSection = findLinkData(`#${hrefHash}`, pageContext)
|
|
69
|
-
sectionTitle =
|
|
69
|
+
sectionTitle = parseMarkdownMini(linkDataPageSection.title)
|
|
70
70
|
} else if ('sectionTitles' in linkData && linkData.sectionTitles) {
|
|
71
71
|
linkData.sectionTitles.forEach((title) => {
|
|
72
72
|
if (determineSectionUrlHash(title) === hrefHash) {
|
|
73
|
-
sectionTitle =
|
|
73
|
+
sectionTitle = parseMarkdownMini(title)
|
|
74
74
|
}
|
|
75
75
|
})
|
|
76
76
|
}
|
|
@@ -13,7 +13,7 @@ import type { NavItem } from '../NavItemComponent'
|
|
|
13
13
|
import type { LinkData } from '../components'
|
|
14
14
|
import type { Exports, PageContextOriginal } from './resolvePageContext'
|
|
15
15
|
import pc from '@brillout/picocolors'
|
|
16
|
-
import {
|
|
16
|
+
import { parseMarkdownMini } from '../parseMarkdownMini'
|
|
17
17
|
import { determineNavItemsColumnLayout } from '../renderer/determineNavItemsColumnLayout'
|
|
18
18
|
assert(!isBrowser())
|
|
19
19
|
|
|
@@ -131,7 +131,7 @@ function getTitles(
|
|
|
131
131
|
|
|
132
132
|
const { title } = activeHeading
|
|
133
133
|
let pageTitle = isLandingPage ? null : title
|
|
134
|
-
let documentTitle = activeHeading.titleDocument || jsxToTextContent(
|
|
134
|
+
let documentTitle = activeHeading.titleDocument || jsxToTextContent(parseMarkdownMini(title))
|
|
135
135
|
|
|
136
136
|
if (!isLandingPage) {
|
|
137
137
|
documentTitle += ' | ' + config.projectInfo.projectName
|
package/dist/NavItemComponent.js
CHANGED
|
@@ -14,15 +14,15 @@ export { getNavItemsWithComputed };
|
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { assert, assertWarning, jsxToTextContent } from './utils/server';
|
|
16
16
|
import './NavItemComponent.css';
|
|
17
|
-
import {
|
|
17
|
+
import { parseMarkdownMini } from './parseMarkdownMini';
|
|
18
18
|
import './global.d.ts';
|
|
19
19
|
function NavItemComponent(_a) {
|
|
20
20
|
var _b;
|
|
21
21
|
var _c;
|
|
22
22
|
var navItem = _a.navItem, onClick = _a.onClick;
|
|
23
23
|
assert([1, 2, 3, 4].includes(navItem.level), navItem);
|
|
24
|
-
var titleJsx =
|
|
25
|
-
var titleInNavJsx =
|
|
24
|
+
var titleJsx = parseMarkdownMini(navItem.title);
|
|
25
|
+
var titleInNavJsx = parseMarkdownMini(navItem.titleInNav);
|
|
26
26
|
var iconSize = 25;
|
|
27
27
|
var icon = navItem.titleIcon && (React.createElement("img", { src: navItem.titleIcon, style: __assign({ height: iconSize, width: iconSize, marginRight: 8 }, navItem.titleIconStyle) }));
|
|
28
28
|
if (navItem.level === 1 || navItem.level === 4) {
|
package/dist/components/Link.js
CHANGED
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { isRepoLink, RepoLink } from './RepoLink';
|
|
4
4
|
import { usePageContext } from '../renderer/usePageContext';
|
|
5
5
|
import { assert, assertUsage, determineSectionTitle, determineSectionUrlHash } from '../utils/server';
|
|
6
|
-
import {
|
|
6
|
+
import { parseMarkdownMini } from '../parseMarkdownMini';
|
|
7
7
|
import pc from '@brillout/picocolors';
|
|
8
8
|
function Link(_a) {
|
|
9
9
|
var href = _a.href, text = _a.text, noBreadcrumb = _a.noBreadcrumb, doNotInferSectionTitle = _a.doNotInferSectionTitle, children = _a.children;
|
|
@@ -27,20 +27,20 @@ function getLinkText(_a) {
|
|
|
27
27
|
assert(isLinkOnSamePage);
|
|
28
28
|
var breadcrumbParts = [];
|
|
29
29
|
if (linkData.linkBreadcrumb) {
|
|
30
|
-
breadcrumbParts.push.apply(breadcrumbParts, ((_b = linkData.linkBreadcrumb) !== null && _b !== void 0 ? _b : []).slice().reverse().map(
|
|
30
|
+
breadcrumbParts.push.apply(breadcrumbParts, ((_b = linkData.linkBreadcrumb) !== null && _b !== void 0 ? _b : []).slice().reverse().map(parseMarkdownMini));
|
|
31
31
|
}
|
|
32
|
-
breadcrumbParts.push(
|
|
32
|
+
breadcrumbParts.push(parseMarkdownMini(linkData.title));
|
|
33
33
|
if (hrefHash) {
|
|
34
34
|
var sectionTitle_1 = undefined;
|
|
35
35
|
assert(!hrefHash.startsWith('#'));
|
|
36
36
|
if (isLinkOnSamePage) {
|
|
37
37
|
var linkDataPageSection = findLinkData("#".concat(hrefHash), pageContext);
|
|
38
|
-
sectionTitle_1 =
|
|
38
|
+
sectionTitle_1 = parseMarkdownMini(linkDataPageSection.title);
|
|
39
39
|
}
|
|
40
40
|
else if ('sectionTitles' in linkData && linkData.sectionTitles) {
|
|
41
41
|
linkData.sectionTitles.forEach(function (title) {
|
|
42
42
|
if (determineSectionUrlHash(title) === hrefHash) {
|
|
43
|
-
sectionTitle_1 =
|
|
43
|
+
sectionTitle_1 = parseMarkdownMini(title);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -22,7 +22,7 @@ export { resolveHeadingsData };
|
|
|
22
22
|
import { assert, isBrowser, jsxToTextContent } from '../utils/server';
|
|
23
23
|
import { getConfig } from './getConfig';
|
|
24
24
|
import pc from '@brillout/picocolors';
|
|
25
|
-
import {
|
|
25
|
+
import { parseMarkdownMini } from '../parseMarkdownMini';
|
|
26
26
|
import { determineNavItemsColumnLayout } from '../renderer/determineNavItemsColumnLayout';
|
|
27
27
|
assert(!isBrowser());
|
|
28
28
|
function resolveHeadingsData(pageContext) {
|
|
@@ -109,7 +109,7 @@ function getTitles(activeHeading, pageContext, config) {
|
|
|
109
109
|
var isLandingPage = url === '/';
|
|
110
110
|
var title = activeHeading.title;
|
|
111
111
|
var pageTitle = isLandingPage ? null : title;
|
|
112
|
-
var documentTitle = activeHeading.titleDocument || jsxToTextContent(
|
|
112
|
+
var documentTitle = activeHeading.titleDocument || jsxToTextContent(parseMarkdownMini(title));
|
|
113
113
|
if (!isLandingPage) {
|
|
114
114
|
documentTitle += ' | ' + config.projectInfo.projectName;
|
|
115
115
|
}
|
|
@@ -7,14 +7,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
export {
|
|
11
|
-
export { withEmoji };
|
|
10
|
+
export { parseMarkdownMini };
|
|
12
11
|
import React from 'react';
|
|
13
|
-
|
|
14
|
-
function parseTitle(title) {
|
|
12
|
+
function parseMarkdownMini(markdown) {
|
|
15
13
|
var parts = [];
|
|
16
14
|
var current;
|
|
17
|
-
|
|
15
|
+
markdown.split('').forEach(function (letter) {
|
|
18
16
|
if (letter === '`') {
|
|
19
17
|
if ((current === null || current === void 0 ? void 0 : current.nodeType) === 'code') {
|
|
20
18
|
// </code>
|
|
@@ -39,14 +37,9 @@ function parseTitle(title) {
|
|
|
39
37
|
if (current) {
|
|
40
38
|
parts.push(current);
|
|
41
39
|
}
|
|
42
|
-
var
|
|
40
|
+
var parsed = React.createElement.apply(React, __spreadArray([React.Fragment,
|
|
43
41
|
{}], parts.map(function (part, i) {
|
|
44
42
|
return React.createElement(part.nodeType === 'code' ? 'code' : React.Fragment, { key: i }, part.content);
|
|
45
43
|
}), false));
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
function withEmoji(name, title) {
|
|
49
|
-
var style = { fontSize: '1.4em' };
|
|
50
|
-
//return React.createElement(React.Fragment, null, Emoji({ name, style }), ' ', title)
|
|
51
|
-
return React.createElement('span', { style: style }, Emoji({ name: name }), ' ', React.createElement('span', { style: { fontSize: '1rem' } }, title));
|
|
44
|
+
return parsed;
|
|
52
45
|
}
|
|
@@ -110,14 +110,14 @@ function parsePageSection(line) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
var pageSectionId = determineSectionUrlHash(anchor);
|
|
113
|
-
var titleParsed =
|
|
113
|
+
var titleParsed = parseMarkdownMini(pageSectionTitle);
|
|
114
114
|
assert(pageSectionId === null || pageSectionId.length > 0);
|
|
115
115
|
var headingId = pageSectionId === null ? '' : " id=\"".concat(pageSectionId, "\"");
|
|
116
116
|
var headingHtml = "<h".concat(pageSectionLevel).concat(headingId, ">").concat(titleParsed, "</h").concat(pageSectionLevel, ">");
|
|
117
117
|
var pageSection = { pageSectionLevel: pageSectionLevel, pageSectionTitle: pageSectionTitle, pageSectionId: pageSectionId, headingHtml: headingHtml };
|
|
118
118
|
return pageSection;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function parseMarkdownMini(titleMarkdown) {
|
|
121
121
|
var parts = [];
|
|
122
122
|
var current;
|
|
123
123
|
titleMarkdown.split('').forEach(function (letter) {
|
package/icons/scroll.svg
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<path d="
|
|
7
|
-
<
|
|
8
|
-
<path d="
|
|
9
|
-
<
|
|
10
|
-
<path d="
|
|
11
|
-
<path d="
|
|
12
|
-
<path d="
|
|
13
|
-
<path
|
|
14
|
-
<path
|
|
15
|
-
<path d="
|
|
16
|
-
<path d="
|
|
17
|
-
<path d="
|
|
18
|
-
<path
|
|
19
|
-
<path d="m45.52 65.26c0.96 0 1.89 0.04 2.83 0.11 1.68 0.12 3.24-0.64 4.87-0.81 2.05-0.21 4.07 0.45 6.1 0.75 2.01 0.3 4.05 0.12 6.07 0 0.92-0.06 1.88-0.14 2.8-0.12 0.99 0.02 1.93 0.33 2.92 0.32 1.27-0.01 2.44-0.57 3.69-0.76 2.78-0.43 5.55 0.97 8.36 0.78 0.92-0.06 1.81-0.29 2.72-0.38 1.12-0.11 2.25-0.01 3.37 0.09l4.98 0.45" opacity=".77"/>
|
|
20
|
-
<path d="m58.39 88.62c0.52 0.01 0.99-0.11 1.5-0.13 0.74-0.04 1.47 0.17 2.2 0.28 1.75 0.26 3.58 0.39 5.32 0.01 0.98-0.22 1.91-0.59 2.91-0.73 2.51-0.36 4.99 0.76 7.54 0.75 2.2-0.02 4.56-1.02 6.73-0.44 1.42 0.37 2.88 0.28 4.38 0.28" opacity=".77"/>
|
|
21
|
-
</g>
|
|
22
|
-
<path d="m38.25 96.18v6.17h84.41c-1.64-3.69-4.64-6.17-8.07-6.17h-5.18z" fill="#fcebcd"/>
|
|
23
|
-
<ellipse cx="38.73" cy="108.83" rx="9.41" ry="12.65" fill="#f2bd72"/>
|
|
24
|
-
<g fill="#784d30">
|
|
25
|
-
<path d="m45.71 108.17c0 5.33-3.34 8.35-6.92 9.33-4.61 1.26-6.53 0.16-6.53 0.16v-18.98s3.25-0.82 6.72 0.16c3.54 0.99 6.73 4 6.73 9.33z"/>
|
|
26
|
-
<ellipse cx="33.48" cy="108.17" rx="6.72" ry="9.65"/>
|
|
27
|
-
<ellipse cx="33.48" cy="108.18" rx="6.72" ry="9.65"/>
|
|
28
|
-
</g>
|
|
29
|
-
<ellipse cx="24.86" cy="108.18" rx="4.46" ry="4.5" fill="#ba793e"/>
|
|
30
|
-
<path d="m33.02 105.44c1.27 0.39 2.82 3.08 0.18 5.66-0.67 0.65 0.02 2.09 0.48 3.3 0.58 1.54 1 2.37 2.34 1.45 1.8-1.22 3.51-4.71 3.51-7.67 0-4.79-2.71-8.68-6.05-8.68-1.72 0-3.06 0.55-4.19 2.88-0.5 1.04-0.55 2.37 1.04 2.53 0 0.01 1.78 0.26 2.69 0.53z" fill="#ba793e"/>
|
|
31
|
-
<ellipse cx="22.34" cy="20.09" rx="10.09" ry="13.57" fill="#f2bd72"/>
|
|
32
|
-
<g fill="#784d30">
|
|
33
|
-
<path d="m29.32 19.43c0 5.33-3.34 8.35-6.92 9.33-4.61 1.26-6.53 0.16-6.53 0.16v-18.98s3.25-0.82 6.72 0.16c3.53 0.98 6.73 4 6.73 9.33z"/>
|
|
34
|
-
<ellipse cx="17.09" cy="19.43" rx="6.72" ry="9.65"/>
|
|
35
|
-
<ellipse cx="17.09" cy="19.44" rx="6.72" ry="9.65"/>
|
|
36
|
-
</g>
|
|
37
|
-
<ellipse cx="8.46" cy="19.44" rx="4.46" ry="4.5" fill="#ba793e"/>
|
|
38
|
-
<path d="m16.62 16.7c1.27 0.39 2.82 3.08 0.18 5.66-0.67 0.65 0.02 2.09 0.48 3.3 0.58 1.54 1 2.37 2.34 1.45 1.8-1.22 3.51-4.71 3.51-7.67 0-4.79-2.71-8.68-6.05-8.68-1.72 0-3.06 0.55-4.19 2.88-0.5 1.04-0.55 2.37 1.04 2.53 0 0.01 1.79 0.25 2.69 0.53z" fill="#ba793e"/>
|
|
39
|
-
</g>
|
|
1
|
+
<svg width="120" height="118" viewBox="0 0 120 118" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M41.3199 12.4466H18.1299V27.9201H41.3199V12.4466Z" fill="#D9B836"/>
|
|
3
|
+
<path d="M110.59 117.96C115.787 117.96 120 112.149 120 104.98C120 97.8112 115.787 91.9998 110.59 91.9998C105.393 91.9998 101.18 97.8112 101.18 104.98C101.18 112.149 105.393 117.96 110.59 117.96Z" fill="#D5BC32"/>
|
|
4
|
+
<path d="M110.59 91.9998H105.41C105.41 91.9998 105.45 26.935 105.45 15.9558C105.45 4.97657 97.8399 0 95.0299 0H18.1299C18.1299 0 28.2299 1.24158 28.3599 15.9558C28.4499 26.4322 28.3599 80.3946 28.3599 97.6433C28.3599 114.892 34.7299 117.95 34.7299 117.95H110.11C110.18 117.95 110.25 117.939 110.32 117.929C110.41 117.929 110.5 117.95 110.59 117.95C115.79 117.95 120 112.142 120 104.97C120 97.8177 115.79 91.9998 110.59 91.9998Z" fill="#FFD511"/>
|
|
5
|
+
<path d="M110.59 91.9998H105.41C105.41 91.9998 105.45 26.935 105.45 15.9558C105.45 4.97657 97.8399 0 95.0299 0H18.1299C18.1299 0 28.2299 1.24158 28.3599 15.9558C28.4499 26.4322 28.3599 80.3946 28.3599 97.6433C28.3599 114.892 34.7299 117.95 34.7299 117.95H110.11C110.18 117.95 110.25 117.939 110.32 117.929C110.41 117.929 110.5 117.95 110.59 117.95C115.79 117.95 120 112.142 120 104.97C120 97.8177 115.79 91.9998 110.59 91.9998Z" fill="#FFD511"/>
|
|
6
|
+
<path d="M28.26 96.689L28.35 87.3516C28.35 87.3516 87.88 93.9801 105.39 72.8631V96.453L28.26 96.689Z" fill="#D5BC32"/>
|
|
7
|
+
<g opacity="0.6">
|
|
8
|
+
<path opacity="0.77" d="M41.52 24.1953C42.69 24.1953 43.87 24.1748 45.04 24.1953C45.93 24.2158 46.76 24.339 47.67 24.2466C48.65 24.144 49.63 23.9491 50.63 23.9798C51.85 24.0209 53.02 24.4005 54.25 24.4005C54.85 24.4005 55.39 24.2261 55.98 24.1953C56.66 24.1645 57.34 24.1953 58.02 24.1953H62.32" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
9
|
+
<path opacity="0.77" d="M75.01 24.1953C75.74 24.1953 76.5 24.2569 77.22 24.144C78.34 23.9696 79.41 23.4976 80.58 23.6002C81.83 23.7131 82.89 24.4621 84.12 24.6571C86.11 24.9546 87.98 23.7336 89.99 23.5386C90.63 23.4771 91.27 23.5181 91.91 23.5694C93.36 23.6925 94.79 23.8772 96.22 24.1132" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
10
|
+
<path opacity="0.77" d="M41.52 48.2162C42.52 48.2162 43.56 48.3188 44.55 48.2162C45.94 48.0726 47.28 47.5698 48.71 47.6416C50.15 47.7134 51.47 48.3599 52.88 48.6164C54.82 48.955 56.77 48.5343 58.69 48.2778C60.74 48.0007 62.69 48.2265 64.75 48.2265H72.45" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
11
|
+
<path opacity="0.77" d="M82.77 48.2163C83.51 48.2163 84.25 48.206 84.99 48.2163C86.24 48.2368 87.17 47.8264 88.36 47.5904C90.05 47.2518 91.74 47.7853 93.41 47.9598C94.64 48.0829 95.93 48.2265 97.16 48.2163" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
12
|
+
<path opacity="0.77" d="M64.5601 72.2782C65.9001 72.2782 67.3001 72.1858 68.6101 72.3705C70.8801 72.6989 72.7901 71.9704 75.0201 71.7344C77.1101 71.5086 79.2001 71.9396 81.3001 72.114C83.4801 72.2987 85.6701 72.2166 87.8601 72.1345C90.1301 72.0524 92.4001 72.2679 94.6901 72.2679" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
13
|
+
<path opacity="0.77" d="M40.5801 72.2782C42.5401 72.2782 44.4701 72.6579 46.4301 72.5142C47.0901 72.4629 47.7501 72.3705 48.4201 72.3398C49.7501 72.2679 51.0901 72.5758 52.4001 72.4219C53.2701 72.3192 54.1001 72.2782 54.9801 72.2782" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
14
|
+
<path opacity="0.77" d="M64.5601 12.2721C65.9001 12.2721 67.3001 12.1797 68.6101 12.3644C70.8801 12.6928 72.7901 11.9643 75.0201 11.7283C77.1101 11.5025 79.2001 11.9335 81.3001 12.1079C83.4801 12.2926 85.6701 12.2105 87.8601 12.1284C90.1301 12.0463 92.4001 12.2618 94.6901 12.2618" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
15
|
+
<path opacity="0.77" d="M40.5801 12.2721C42.5401 12.2721 44.4701 12.6517 46.4301 12.5081C47.0901 12.4568 47.7501 12.3644 48.4201 12.3337C49.7501 12.2618 51.0901 12.5697 52.4001 12.4157C53.2701 12.3131 54.1001 12.2721 54.9801 12.2721" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
16
|
+
<path opacity="0.77" d="M41.52 36.2725C42.48 36.2725 43.41 36.3135 44.35 36.3853C46.03 36.5085 47.59 35.7286 49.22 35.5542C51.27 35.3387 53.29 36.016 55.32 36.3238C57.33 36.6316 59.37 36.4469 61.39 36.3238C62.31 36.2622 63.27 36.1801 64.19 36.2006C65.18 36.2212 66.12 36.5393 67.11 36.529C68.38 36.5187 69.55 35.9441 70.8 35.7492C73.58 35.3079 76.35 36.7445 79.16 36.5495C80.08 36.488 80.97 36.252 81.88 36.1596C83 36.0467 84.13 36.1493 85.25 36.252L90.23 36.7137" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
17
|
+
<path opacity="0.77" d="M41.52 60.2729C42.48 60.2729 43.41 60.3139 44.35 60.3857C46.03 60.5089 47.59 59.729 49.22 59.5546C51.27 59.3391 53.29 60.0163 55.32 60.3242C57.33 60.632 59.37 60.4473 61.39 60.3242C62.31 60.2626 63.27 60.1805 64.19 60.201C65.18 60.2216 66.12 60.5397 67.11 60.5294C68.38 60.5191 69.55 59.9445 70.8 59.7496C73.58 59.3083 76.35 60.7449 79.16 60.5499C80.08 60.4884 80.97 60.2524 81.88 60.16C83 60.0471 84.13 60.1497 85.25 60.2523L90.23 60.7141" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
18
|
+
<path opacity="0.77" d="M54.3901 84.2425C54.9101 84.2528 55.3801 84.1296 55.8901 84.1091C56.6301 84.0681 57.3601 84.2835 58.0901 84.3964C59.8401 84.6632 61.6701 84.7966 63.4101 84.4067C64.3901 84.1809 65.3201 83.8013 66.3201 83.6576C68.8301 83.2882 71.3101 84.4375 73.8601 84.4272C76.0601 84.4067 78.4201 83.3806 80.5901 83.9757C82.0101 84.3554 83.4701 84.263 84.9701 84.263" stroke="#9E673C" stroke-width="3.0045" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
40
19
|
</g>
|
|
20
|
+
<path d="M34.25 91.9998V98.3308H118.66C117.02 94.5445 114.02 91.9998 110.59 91.9998H105.41H34.25Z" fill="#F9FFA8"/>
|
|
21
|
+
<path d="M34.7301 117.96C39.9271 117.96 44.1401 112.149 44.1401 104.98C44.1401 97.8112 39.9271 91.9998 34.7301 91.9998C29.5331 91.9998 25.3201 97.8112 25.3201 104.98C25.3201 112.149 29.5331 117.96 34.7301 117.96Z" fill="#D5BC32"/>
|
|
22
|
+
<path d="M41.71 104.303C41.71 109.772 38.37 112.871 34.79 113.876C30.18 115.169 28.26 114.04 28.26 114.04V94.565C28.26 94.565 31.51 93.7236 34.98 94.7292C38.52 95.745 41.71 98.8336 41.71 104.303Z" fill="#784D30"/>
|
|
23
|
+
<path d="M29.48 114.204C33.1914 114.204 36.2 109.771 36.2 104.303C36.2 98.834 33.1914 94.4008 29.48 94.4008C25.7687 94.4008 22.76 98.834 22.76 104.303C22.76 109.771 25.7687 114.204 29.48 114.204Z" fill="#784D30"/>
|
|
24
|
+
<path d="M29.48 114.215C33.1914 114.215 36.2 109.782 36.2 104.313C36.2 98.8443 33.1914 94.4111 29.48 94.4111C25.7687 94.4111 22.76 98.8443 22.76 104.313C22.76 109.782 25.7687 114.215 29.48 114.215Z" fill="#784D30"/>
|
|
25
|
+
<path d="M20.8599 108.93C23.3231 108.93 25.3199 106.863 25.3199 104.313C25.3199 101.763 23.3231 99.6955 20.8599 99.6955C18.3967 99.6955 16.3999 101.763 16.3999 104.313C16.3999 106.863 18.3967 108.93 20.8599 108.93Z" fill="#BA793E"/>
|
|
26
|
+
<path d="M29.0199 101.501C30.2899 101.902 31.8399 104.662 29.1999 107.309C28.5299 107.976 29.2199 109.454 29.6799 110.695C30.2599 112.275 30.6799 113.127 32.0199 112.183C33.8199 110.931 35.5299 107.35 35.5299 104.313C35.5299 99.3979 32.8199 95.4064 29.4799 95.4064C27.7599 95.4064 26.4199 95.9708 25.2899 98.3616C24.7899 99.4287 24.7399 100.793 26.3299 100.958C26.3299 100.968 28.1099 101.224 29.0199 101.501Z" fill="#BA793E"/>
|
|
27
|
+
<path d="M18.34 27.8482C23.9126 27.8482 28.43 21.6142 28.43 13.9241C28.43 6.23404 23.9126 0 18.34 0C12.7674 0 8.25 6.23404 8.25 13.9241C8.25 21.6142 12.7674 27.8482 18.34 27.8482Z" fill="#D5BC32"/>
|
|
28
|
+
<path d="M25.3201 13.2469C25.3201 18.716 21.9801 21.8148 18.4001 22.8203C13.7901 24.1132 11.8701 22.9845 11.8701 22.9845V3.50921C11.8701 3.50921 15.1201 2.66781 18.5901 3.67339C22.1201 4.67896 25.3201 7.77777 25.3201 13.2469Z" fill="#784D30"/>
|
|
29
|
+
<path d="M13.0901 23.1487C16.8015 23.1487 19.8101 18.7155 19.8101 13.2469C19.8101 7.77823 16.8015 3.34503 13.0901 3.34503C9.37876 3.34503 6.37012 7.77823 6.37012 13.2469C6.37012 18.7155 9.37876 23.1487 13.0901 23.1487Z" fill="#784D30"/>
|
|
30
|
+
<path d="M13.0901 23.159C16.8015 23.159 19.8101 18.7258 19.8101 13.2571C19.8101 7.78852 16.8015 3.35532 13.0901 3.35532C9.37876 3.35532 6.37012 7.78852 6.37012 13.2571C6.37012 18.7258 9.37876 23.159 13.0901 23.159Z" fill="#784D30"/>
|
|
31
|
+
<path d="M4.46 17.8746C6.92319 17.8746 8.92 15.8073 8.92 13.2572C8.92 10.707 6.92319 8.63974 4.46 8.63974C1.99681 8.63974 0 10.707 0 13.2572C0 15.8073 1.99681 17.8746 4.46 17.8746Z" fill="#BA793E"/>
|
|
32
|
+
<path d="M12.62 10.4457C13.89 10.8459 15.44 13.6061 12.8 16.2534C12.13 16.9203 12.82 18.3979 13.28 19.6395C13.86 21.2197 14.28 22.0713 15.62 21.1273C17.42 19.8755 19.13 16.2944 19.13 13.2572C19.13 8.34218 16.42 4.35066 13.08 4.35066C11.36 4.35066 10.02 4.91502 8.89 7.30582C8.39 8.37296 8.34 9.73767 9.93 9.90184C9.93 9.9121 11.72 10.1584 12.62 10.4457Z" fill="#BA793E"/>
|
|
41
33
|
</svg>
|
package/index.ts
CHANGED
|
@@ -12,5 +12,6 @@ export { usePageContext } from './renderer/usePageContext'
|
|
|
12
12
|
export * from './components/Note'
|
|
13
13
|
export * from './icons/index'
|
|
14
14
|
export { assert } from './utils/assert'
|
|
15
|
+
export { parseMarkdownMini } from './parseMarkdownMini'
|
|
15
16
|
export type { Config } from './types/Config'
|
|
16
17
|
export type { HeadingDefinition, HeadingDetachedDefinition } from './types/Heading'
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { withEmoji }
|
|
1
|
+
export { parseMarkdownMini }
|
|
3
2
|
|
|
4
3
|
import React from 'react'
|
|
5
|
-
import { Emoji, EmojiName } from './utils/server'
|
|
6
4
|
|
|
7
|
-
function
|
|
5
|
+
function parseMarkdownMini(markdown: string): JSX.Element {
|
|
8
6
|
type Part = { nodeType: 'text' | 'code'; content: string }
|
|
9
7
|
const parts: Part[] = []
|
|
10
8
|
let current: Part | undefined
|
|
11
|
-
|
|
9
|
+
markdown.split('').forEach((letter) => {
|
|
12
10
|
if (letter === '`') {
|
|
13
11
|
if (current?.nodeType === 'code') {
|
|
14
12
|
// </code>
|
|
@@ -32,7 +30,7 @@ function parseTitle(title: string): JSX.Element {
|
|
|
32
30
|
parts.push(current)
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
const
|
|
33
|
+
const parsed = React.createElement(
|
|
36
34
|
React.Fragment,
|
|
37
35
|
{},
|
|
38
36
|
...parts.map((part, i) =>
|
|
@@ -40,17 +38,5 @@ function parseTitle(title: string): JSX.Element {
|
|
|
40
38
|
),
|
|
41
39
|
)
|
|
42
40
|
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function withEmoji(name: EmojiName, title: string | JSX.Element): JSX.Element {
|
|
47
|
-
const style = { fontSize: '1.4em' }
|
|
48
|
-
//return React.createElement(React.Fragment, null, Emoji({ name, style }), ' ', title)
|
|
49
|
-
return React.createElement(
|
|
50
|
-
'span',
|
|
51
|
-
{ style },
|
|
52
|
-
Emoji({ name }),
|
|
53
|
-
' ',
|
|
54
|
-
React.createElement('span', { style: { fontSize: '1rem' } }, title),
|
|
55
|
-
)
|
|
41
|
+
return parsed
|
|
56
42
|
}
|
package/parsePageSections.ts
CHANGED
|
@@ -86,7 +86,7 @@ function parsePageSection(line: string): PageSection & { headingHtml: string } {
|
|
|
86
86
|
}
|
|
87
87
|
const pageSectionId = determineSectionUrlHash(anchor)
|
|
88
88
|
|
|
89
|
-
const titleParsed =
|
|
89
|
+
const titleParsed = parseMarkdownMini(pageSectionTitle)
|
|
90
90
|
assert(pageSectionId === null || pageSectionId.length > 0)
|
|
91
91
|
const headingId = pageSectionId === null ? '' : ` id="${pageSectionId}"`
|
|
92
92
|
const headingHtml = `<h${pageSectionLevel}${headingId}>${titleParsed}</h${pageSectionLevel}>`
|
|
@@ -95,7 +95,7 @@ function parsePageSection(line: string): PageSection & { headingHtml: string } {
|
|
|
95
95
|
return pageSection
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
function
|
|
98
|
+
function parseMarkdownMini(titleMarkdown: string): string {
|
|
99
99
|
type Part = { nodeType: 'text' | 'code'; content: string }
|
|
100
100
|
const parts: Part[] = []
|
|
101
101
|
let current: Part | undefined
|
package/utils/Emoji/Emoji.ts
CHANGED
package/dist/parseTitle.d.ts
DELETED