@donotdev/templates 0.0.4 → 0.0.5
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.
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
1
|
export interface MarkdownViewerProps {
|
|
3
|
-
/**
|
|
4
|
-
html?: string;
|
|
5
|
-
/** Raw markdown content (parses on client) */
|
|
2
|
+
/** Raw markdown content */
|
|
6
3
|
content?: string;
|
|
7
4
|
/** Additional CSS classes */
|
|
8
5
|
className?: string;
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
* MarkdownViewer - Renders markdown content using framework components
|
|
12
|
-
*
|
|
13
|
-
* Features:
|
|
14
|
-
* - Accepts pre-parsed HTML (Next.js SSR) or raw markdown (client-side)
|
|
15
|
-
* - Code blocks use framework Code component (Shiki syntax highlighting)
|
|
16
|
-
* - Links use framework Link component (internal) or <a> (external)
|
|
17
|
-
* - Framework prose typography
|
|
18
|
-
* - Theme-aware styling
|
|
19
|
-
* - 100% Lighthouse compliant
|
|
20
|
-
*
|
|
21
|
-
* @version 0.0.1
|
|
22
|
-
* @since 0.0.1
|
|
23
|
-
* @author AMBROISE PARK Consulting
|
|
24
|
-
*/
|
|
25
|
-
export declare const MarkdownViewer: ComponentType<MarkdownViewerProps>;
|
|
7
|
+
export declare const MarkdownViewer: import("react").NamedExoticComponent<MarkdownViewerProps>;
|
|
26
8
|
export default MarkdownViewer;
|
|
27
9
|
//# sourceMappingURL=MarkdownViewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownViewer.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownViewer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MarkdownViewer.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownViewer.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAqED,eAAO,MAAM,cAAc,2DAA2B,CAAC;AACvD,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as s}from"react/jsx-runtime";import{memo as p,useMemo as h}from"react";import{marked as x}from"marked";import g,{domToReact as k,Element as a}from"html-react-parser";import{Code as w,cn as b}from"@donotdev/components";import{Link as E}from"@donotdev/ui";function m(n){let o="";for(const r of n.children)r.type==="text"?o+=r.data:r instanceof a&&(o+=m(r));return o}const M=({content:n,className:o})=>{const r=h(()=>{if(!n)return null;const d=x.parse(n,{async:!1,gfm:!0,breaks:!0});return g(d,{replace(i){if(!(i instanceof a))return;const{name:c,attribs:u,children:f}=i;if(c==="pre"){const e=f.find(t=>t instanceof a&&t.name==="code");if(e){const t=/language-(\w+)/.exec(e.attribs?.class||"")?.[1]||"text";return s(w,{language:t,children:m(e).replace(/\n$/,"")})}}if(c==="a"){const e=u?.href||"",t=e.startsWith("http")||e.startsWith("//"),l=k(f);return t?s("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:l}):s(E,{path:e,children:l})}}})},[n]);return r?s("div",{className:b("prose",o),children:r}):null},j=p(M);var B=j;export{j as MarkdownViewer,B as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/templates",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -45,19 +45,20 @@
|
|
|
45
45
|
"type-check": "tsc --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@donotdev/adv-comps": "0.0.
|
|
49
|
-
"@donotdev/components": "0.0.
|
|
50
|
-
"@donotdev/core": "0.0.
|
|
51
|
-
"@donotdev/crud": "0.0.
|
|
52
|
-
"@donotdev/ui": "0.0.
|
|
48
|
+
"@donotdev/adv-comps": "0.0.5",
|
|
49
|
+
"@donotdev/components": "0.0.5",
|
|
50
|
+
"@donotdev/core": "0.0.5",
|
|
51
|
+
"@donotdev/crud": "0.0.5",
|
|
52
|
+
"@donotdev/ui": "0.0.5",
|
|
53
53
|
"@hookform/resolvers": "^5.2.2",
|
|
54
|
+
"html-react-parser": "^5.2.11",
|
|
54
55
|
"marked": "^17.0.1",
|
|
55
|
-
"react-hook-form": "^7.
|
|
56
|
+
"react-hook-form": "^7.71.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
|
-
"@donotdev/auth": "0.0.
|
|
59
|
-
"@donotdev/billing": "0.0.
|
|
60
|
-
"@donotdev/oauth": "0.0.
|
|
59
|
+
"@donotdev/auth": "0.0.5",
|
|
60
|
+
"@donotdev/billing": "0.0.5",
|
|
61
|
+
"@donotdev/oauth": "0.0.5",
|
|
61
62
|
"lucide-react": "^0.562.0",
|
|
62
63
|
"react": "^19.2.3",
|
|
63
64
|
"react-dom": "^19.2.3",
|