@readme/markdown 6.75.0-beta.27 → 6.75.0-beta.28

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.
@@ -0,0 +1,3 @@
1
+ import { CodeTabs } from '../../types';
2
+ declare const codeTabs: (node: CodeTabs, _: any, state: any, info: any) => any;
3
+ export default codeTabs;
@@ -0,0 +1,3 @@
1
+ import { Gemoji } from '../../types';
2
+ declare const gemoji: (node: Gemoji) => string;
3
+ export default gemoji;
@@ -0,0 +1,7 @@
1
+ declare const compilers: {
2
+ handlers: {
3
+ emoji: (node: import("../../types").Gemoji) => string;
4
+ "code-tabs": (node: import("../../types").CodeTabs, _: any, state: any, info: any) => any;
5
+ };
6
+ };
7
+ export default compilers;
@@ -0,0 +1,2 @@
1
+ declare const codeTabs: () => (tree: any) => any;
2
+ export default codeTabs;
@@ -0,0 +1,3 @@
1
+ import { Root } from 'mdast';
2
+ declare const gemojiTransformer: () => (tree: Root) => Root;
3
+ export default gemojiTransformer;
@@ -0,0 +1,2 @@
1
+ declare const _default: (() => (tree: any) => void)[];
2
+ export default _default;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@readme/markdown",
3
3
  "description": "ReadMe's React-based Markdown parser",
4
4
  "author": "Rafe Goldberg <rafe@readme.io>",
5
- "version": "6.75.0-beta.27",
5
+ "version": "6.75.0-beta.28",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",
@@ -24,15 +24,17 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@mdx-js/mdx": "^3.0.0",
27
- "@readme/emojis": "^5.0.0",
27
+ "@readme/emojis": "^5.1.0",
28
28
  "@readme/syntax-highlighter": "^13.0.0",
29
29
  "copy-to-clipboard": "^3.3.2",
30
30
  "core-js": "^3.36.1",
31
31
  "debug": "^4.3.4",
32
32
  "emoji-regex": "^10.2.1",
33
+ "gemoji": "^8.1.0",
33
34
  "hast-util-sanitize": "^4.0.0",
34
35
  "lodash.escape": "^4.0.1",
35
36
  "lodash.kebabcase": "^4.1.1",
37
+ "mdast-util-find-and-replace": "^3.0.1",
36
38
  "mdast-util-toc": "^5.1.0",
37
39
  "path-browserify": "^1.0.1",
38
40
  "process": "^0.11.10",
@@ -40,8 +42,11 @@
40
42
  "rehype-sanitize": "^4.0.0",
41
43
  "remark": "^15.0.1",
42
44
  "remark-frontmatter": "^5.0.0",
45
+ "remark-gfm": "^4.0.0",
43
46
  "remark-mdx": "^3.0.0",
44
47
  "remark-parse": "^11.0.0",
48
+ "remark-rehype": "^11.1.0",
49
+ "remark-stringify": "^11.0.0",
45
50
  "trim": "^1.0.1",
46
51
  "unified": "^8.4.0",
47
52
  "unist-util-flatmap": "^1.0.0",
@@ -100,7 +105,7 @@
100
105
  "string.prototype.trimend": "^1.0.6",
101
106
  "terser-webpack-plugin": "^5.3.7",
102
107
  "ts-loader": "^9.4.2",
103
- "typescript": "^5.0.3",
108
+ "typescript": "^5.4.5",
104
109
  "vitest": "^1.4.0",
105
110
  "webpack": "^5.56.0",
106
111
  "webpack-cli": "^5.0.1",
@@ -1,100 +0,0 @@
1
- import copy from 'copy-to-clipboard';
2
- import { string, oneOfType, func, shape, instanceOf, arrayOf, bool } from 'prop-types';
3
- import React, { createRef, Element, Fragment } from 'react';
4
-
5
- // Only load CodeMirror in the browser, for SSR
6
- // apps. Necessary because of people like this:
7
- // https://github.com/codemirror/CodeMirror/issues/3701#issuecomment-164904534
8
- let syntaxHighlighter;
9
- let canonicalLanguage = () => {};
10
- if (typeof window !== 'undefined') {
11
- // eslint-disable-next-line global-require
12
- syntaxHighlighter = require('@readme/syntax-highlighter').default;
13
- // eslint-disable-next-line global-require
14
- ({ canonical: canonicalLanguage } = require('@readme/syntax-highlighter'));
15
- }
16
-
17
- function CopyCode({ codeRef, rootClass = 'rdmd-code-copy', className = '' }) {
18
- const copyClass = `${rootClass}_copied`;
19
- const button = createRef();
20
- /* istanbul ignore next */
21
- const copier = () => {
22
- const code = codeRef.current.textContent;
23
-
24
- if (copy(code)) {
25
- const $el = button.current;
26
- $el.classList.add(copyClass);
27
- setTimeout(() => $el.classList.remove(copyClass), 1500);
28
- }
29
- };
30
- return <button ref={button} aria-label="Copy Code" className={`${rootClass} ${className}`} onClick={copier} />;
31
- }
32
-
33
- CopyCode.propTypes = {
34
- className: string,
35
- codeRef: oneOfType([func, shape({ current: instanceOf(Element) })]).isRequired,
36
- rootClass: string,
37
- };
38
-
39
- function Code(props) {
40
- const { children, className, copyButtons, lang, meta, theme } = props;
41
-
42
- const langClass = className.search(/lang(?:uage)?-\w+/) >= 0 ? className.match(/\s?lang(?:uage)?-(\w+)/)[1] : '';
43
- const language = canonicalLanguage(lang) || langClass;
44
-
45
- const codeRef = createRef();
46
-
47
- const codeOpts = {
48
- inline: !lang,
49
- tokenizeVariables: true,
50
- dark: theme === 'dark',
51
- };
52
-
53
- const codeContent =
54
- syntaxHighlighter && children ? syntaxHighlighter(children[0], language, codeOpts) : children?.[0] || '';
55
-
56
- return (
57
- <Fragment>
58
- {copyButtons && <CopyCode className="fa" codeRef={codeRef} />}
59
- <code
60
- ref={codeRef}
61
- className={['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' ')}
62
- data-lang={language}
63
- name={meta}
64
- suppressHydrationWarning={true}
65
- >
66
- {codeContent}
67
- </code>
68
- </Fragment>
69
- );
70
- }
71
-
72
- function CreateCode({ copyButtons, theme }) {
73
- // eslint-disable-next-line react/display-name
74
- return props => <Code {...props} copyButtons={copyButtons} theme={theme} />;
75
- }
76
-
77
- Code.propTypes = {
78
- children: arrayOf(string),
79
- className: string,
80
- copyButtons: bool,
81
- lang: string,
82
- meta: string,
83
- theme: string,
84
- };
85
-
86
- Code.defaultProps = {
87
- className: '',
88
- copyButtons: true,
89
- lang: '',
90
- meta: '',
91
- };
92
-
93
- CreateCode.sanitize = sanitizeSchema => {
94
- // This is for code blocks class name
95
- sanitizeSchema.attributes.code = ['className', 'lang', 'meta', 'value'];
96
-
97
- return sanitizeSchema;
98
- };
99
-
100
- export default CreateCode;