@brillout/docpress 0.1.4 → 0.1.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/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { CodeBlock }
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { assert, objectAssign } from '../utils'
|
|
5
|
+
|
|
6
|
+
function CodeBlock({ children, lineBreak }: { children: any; lineBreak?: true }) {
|
|
7
|
+
assert(lineBreak, '`lineBreak: true` is currently the only use case for <CodeBlock>')
|
|
8
|
+
const style = {}
|
|
9
|
+
if (lineBreak) {
|
|
10
|
+
objectAssign(style, {
|
|
11
|
+
wordWrap: 'break-word',
|
|
12
|
+
wordBreak: 'break-all',
|
|
13
|
+
whiteSpace: 'initial',
|
|
14
|
+
paddingRight: '16px !important'
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
return (
|
|
18
|
+
<pre>
|
|
19
|
+
<code style={style}>{children}</code>
|
|
20
|
+
</pre>
|
|
21
|
+
)
|
|
22
|
+
}
|
package/src/components/Note.tsx
CHANGED
package/src/components/index.ts
CHANGED
package/src/headings.ts
CHANGED
|
@@ -61,7 +61,7 @@ function getHeadings(config: { headings: HeadingDefinition[]; headingsWithoutLin
|
|
|
61
61
|
// if (heading.titleSize) {
|
|
62
62
|
// titleParsed = React.createElement('span', { style: { fontSize: heading.titleSize } }, titleParsed)
|
|
63
63
|
// }
|
|
64
|
-
titleInNavProcessed = React.createElement(React.Fragment, {},
|
|
64
|
+
titleInNavProcessed = React.createElement(React.Fragment, {}, getListPrefix(), titleParsed)
|
|
65
65
|
} else {
|
|
66
66
|
titleInNavProcessed = parseTitle(titleInNav)
|
|
67
67
|
}
|
|
@@ -180,14 +180,9 @@ function parseTitle(title: string): JSX.Element {
|
|
|
180
180
|
const titleJsx = React.createElement(
|
|
181
181
|
React.Fragment,
|
|
182
182
|
{},
|
|
183
|
-
...parts.map((part) =>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
} else {
|
|
187
|
-
assert(part.nodeType === 'text')
|
|
188
|
-
return part.content
|
|
189
|
-
}
|
|
190
|
-
})
|
|
183
|
+
...parts.map((part, i) =>
|
|
184
|
+
React.createElement(part.nodeType === 'code' ? 'code' : React.Fragment, { key: i }, part.content)
|
|
185
|
+
)
|
|
191
186
|
)
|
|
192
187
|
|
|
193
188
|
return titleJsx
|