@brillout/docpress 0.6.15 → 0.6.17

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.
@@ -25,7 +25,6 @@ blockquote.note-color-green {
25
25
  border-left-color: rgb(0, 179, 0, 0.3);
26
26
  background-color: rgb(0, 179, 0, 0.08);
27
27
  }
28
- /*
29
28
  blockquote.note-color-pink {
30
29
  --color-strengh-bg: 4;
31
30
  --color-strengh-border: 4;
@@ -33,7 +32,6 @@ blockquote.note-color-pink {
33
32
  border-left-color: rgb(255, 0, 100, 0.3);
34
33
  background-color: rgb(255, 0, 100, 0.1);
35
34
  }
36
- */
37
35
  .blockquote-content {
38
36
  display: inline;
39
37
  }
@@ -47,20 +45,6 @@ blockquote.custom-icon > .blockquote-content > :first-child {
47
45
  /************************/
48
46
  /*** Icon Positioning ***/
49
47
  /************************/
50
- blockquote.type-construction img[src^="https://twemoji."]
51
- {
52
- margin-right: 2px;
53
- }
54
- blockquote.type-warning img[src^="https://twemoji."]
55
- {
56
- position: relative;
57
- top: -1px;
58
- margin-right: 2px;
59
- }
60
- blockquote.type-danger img[src^="https://twemoji."]
61
- {
62
- margin-right: 2px;
63
- }
64
48
  blockquote > p:first-child::before,
65
49
  /* blockquote > p:first-of-type::before, */
66
50
  blockquote > div.paragraph:first-child::before {
@@ -1,4 +1,5 @@
1
1
  export { Warning }
2
+ export { Advanced }
2
3
  export { Construction }
3
4
  export { Contribution }
4
5
  export { Danger }
@@ -21,6 +22,9 @@ import './Note.css'
21
22
  function Warning({ children }: { children: React.ReactNode }) {
22
23
  return <NoteGeneric type="warning">{children}</NoteGeneric>
23
24
  }
25
+ function Advanced({ children }: { children: React.ReactNode }) {
26
+ return <NoteGeneric type="advanced">{children}</NoteGeneric>
27
+ }
24
28
  function Construction({ children }: { children: React.ReactNode }) {
25
29
  return <NoteGeneric type="construction">{children}</NoteGeneric>
26
30
  }
@@ -47,10 +51,11 @@ function NoteGeneric({
47
51
  }: {
48
52
  icon?: null | CustomIcon
49
53
  iconMargin?: null | number
50
- type?: 'danger' | 'warning' | 'construction' | 'contribution'
54
+ type?: 'danger' | 'warning' | 'construction' | 'contribution' | 'advanced'
51
55
  children: React.ReactNode
52
56
  }) {
53
57
  assert(icon === null || icon || type, { icon, type })
58
+ iconMargin ??= 2
54
59
 
55
60
  let className = 'custom-icon'
56
61
  if (type) {
@@ -59,21 +64,24 @@ function NoteGeneric({
59
64
  if (!icon && type) {
60
65
  let classColor = ''
61
66
  if (type === 'danger') {
62
- icon = ':no_entry:'
67
+ icon = ''
63
68
  classColor = 'note-color-red'
64
69
  }
65
70
  if (type === 'warning') {
66
- icon = ':warning:'
71
+ icon = '⚠️'
67
72
  classColor = 'note-color-yellow'
68
73
  }
69
74
  if (type === 'construction') {
70
- icon = ':construction:'
75
+ icon = '🚧'
71
76
  classColor = 'note-color-yellow'
72
77
  }
73
78
  if (type === 'contribution') {
74
79
  icon = '💚'
75
80
  classColor = 'note-color-green'
76
- iconMargin = 2
81
+ }
82
+ if (type === 'advanced') {
83
+ icon = '🧠'
84
+ classColor = 'note-color-pink'
77
85
  }
78
86
  assert(icon)
79
87
  assert(classColor)
@@ -82,7 +90,9 @@ function NoteGeneric({
82
90
  return (
83
91
  <blockquote className={className}>
84
92
  <div style={{ marginBottom: 20 }} />
85
- {icon}<span style={{width: iconMargin ?? undefined, display: 'inline-block'}}></span> <div className="blockquote-content">{children}</div>
93
+ <span style={{ fontFamily: 'emoji' }}>{icon}</span>
94
+ <span style={{ width: iconMargin ?? undefined, display: 'inline-block' }}></span>{' '}
95
+ <div className="blockquote-content">{children}</div>
86
96
  <div style={{ marginTop: 20 }} />
87
97
  </blockquote>
88
98
  )
@@ -4,11 +4,6 @@ pre > code {
4
4
  pre [data-line] {
5
5
  padding: 0px 16px !important;
6
6
  }
7
- @media screen and (max-width: 900px) {
8
- pre > code {
9
- font-size: 0.7em;
10
- }
11
- }
12
7
  pre {
13
8
  display: grid;
14
9
  }
@@ -17,27 +12,38 @@ pre > code {
17
12
  overflow-x: auto;
18
13
  }
19
14
 
20
- @media screen and (max-width: 1139px) {
15
+ pre > code {
16
+ display: reset;
17
+ word-break: reset;
18
+ }
19
+
20
+ figure[data-rehype-pretty-code-figure] {
21
+ margin: 0 !important;
22
+ }
23
+
24
+ /* 821px screen width => the width of code blocks isn't shrinked anymore => no need to reduce the font-size of code blocks */
25
+ @media screen and (max-width: 820px) {
21
26
  pre > code {
22
- font-size: 0.95em;
27
+ font-size: 0.9em !important;
23
28
  }
24
29
  }
25
- @media screen and (max-width: 1040px) {
30
+ @media screen and (max-width: 720px) {
26
31
  pre > code {
27
- font-size: 0.8em;
32
+ font-size: 0.8em !important;
28
33
  }
29
34
  }
30
- @media screen and (max-width: 940px) {
35
+ @media screen and (max-width: 620px) {
31
36
  pre > code {
32
- font-size: 0.7em;
37
+ font-size: 0.7em !important;
33
38
  }
34
39
  }
35
-
36
- pre > code {
37
- display: reset;
38
- word-break: reset;
40
+ @media screen and (max-width: 550px) {
41
+ pre > code {
42
+ font-size: 0.6em !important;
43
+ }
39
44
  }
40
-
41
- figure[data-rehype-pretty-code-figure] {
42
- margin: 0 !important;
45
+ @media screen and (max-width: 450px) {
46
+ pre > code {
47
+ font-size: 0.5em !important;
48
+ }
43
49
  }
package/css/heading.css CHANGED
@@ -1,6 +1,6 @@
1
1
  h1 { font-size: 2.30em }
2
2
  h2 { font-size: 1.80em }
3
- h3 { font-size: 1.15em }
3
+ h3 { font-size: 1.25em }
4
4
 
5
5
  .doc-page h1 {
6
6
  margin-top: 20px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "// Build vite.config.ts and +config.ts": "",
@@ -25,7 +25,6 @@
25
25
  "rehype-pretty-code": "0.13.0",
26
26
  "remark-gfm": "4.0.0",
27
27
  "shiki": "1.2.0",
28
- "twemoji": "13.1.1",
29
28
  "vike-contributors": "^0.0.9"
30
29
  },
31
30
  "peerDependencies": {
@@ -77,7 +76,7 @@
77
76
  "react": "^18.2.0",
78
77
  "react-dom": "^18.2.0",
79
78
  "typescript": "^5.4.3",
80
- "vike": "^0.4.174",
79
+ "vike": "^0.4.180",
81
80
  "vite": "^5.2.2"
82
81
  },
83
82
  "repository": "https://github.com/brillout/docpress",
@@ -6,7 +6,6 @@ import { escapeInject, dangerouslySkipEscape } from 'vike/server'
6
6
  import { PageLayout } from '../PageLayout'
7
7
  import { resolvePageContext, PageContextOriginal } from '../config/resolvePageContext'
8
8
  import { getDocSearchJS, getDocSearchCSS } from '../algolia/DocSearch'
9
- import { parseEmojis } from '../parseEmojis'
10
9
  import { assert } from '../utils/server'
11
10
 
12
11
  async function onRenderHtml(pageContextOriginal: PageContextOriginal) {
@@ -26,8 +25,7 @@ async function onRenderHtml(pageContextOriginal: PageContextOriginal) {
26
25
  const docSearchJS = getDocSearchJS(pageContextResolved)
27
26
  const docSearchCSS = getDocSearchCSS(pageContextResolved)
28
27
 
29
- let pageHtml = ReactDOMServer.renderToString(page)
30
- pageHtml = parseEmojis(pageHtml)
28
+ const pageHtml = ReactDOMServer.renderToString(page)
31
29
 
32
30
  return escapeInject`<!DOCTYPE html>
33
31
  <html>
package/parseEmojis.ts DELETED
@@ -1,35 +0,0 @@
1
- export { parseEmojis }
2
-
3
- import twemoji from 'twemoji'
4
-
5
- const emojiList = {
6
- // https://emojipedia.org/no-entry/
7
- ':no_entry:': 0x26d4,
8
- // https://emojipedia.org/warning/
9
- ':warning:': 0x26a0,
10
- // https://emojipedia.org/trophy/
11
- ':trophy:': 0x1f3c6,
12
- // https://emojipedia.org/construction/
13
- ':construction:': 0x1f6a7,
14
- /*
15
- // https://emojipedia.org/red-heart/
16
- ':heart:': 0x2764,
17
- */
18
- }
19
-
20
- function parseEmojis(html: string) {
21
- Object.entries(emojiList).forEach(([shortcode, codepoint]) => {
22
- if (!html.includes(shortcode)) {
23
- return
24
- }
25
- const emojiStr = twemoji.convert.fromCodePoint(codepoint as any)
26
- let emojiImg: any = twemoji.parse(emojiStr, {
27
- folder: 'svg',
28
- ext: '.svg',
29
- })
30
- const style = 'height: 1.275em; width: 1.275em; vertical-align: -20%'
31
- emojiImg = emojiImg.replace('<img class="emoji" ', `<img style="${style}" `)
32
- html = html.split(shortcode).join(emojiImg)
33
- })
34
- return html
35
- }