From 47210c63edeba2b2f57223d419eb2f4d4fd9fc0f Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 10 May 2021 12:14:05 +1000 Subject: [PATCH] GraphContent: make links inline --- .../components/Graph/GraphContent.tsx | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/pkg/interface/src/views/landscape/components/Graph/GraphContent.tsx b/pkg/interface/src/views/landscape/components/Graph/GraphContent.tsx index 673b12639d..de38b1f675 100644 --- a/pkg/interface/src/views/landscape/components/Graph/GraphContent.tsx +++ b/pkg/interface/src/views/landscape/components/Graph/GraphContent.tsx @@ -230,28 +230,24 @@ const header = ({ children, depth, ...rest }) => { const level = depth; const inner = level === 1 ? ( -

{children}

+

{children}

) : level === 2 ? ( -

{children}

+

{children}

) : level === 3 ? ( -

{children}

+

{children}

) : ( -

{children}

+

{children}

); - return ( - - {inner} - - ); + return {inner}; }; const renderers = { heading: header, break: () => { - return + return ; }, thematicBreak: () => { - return + return ; }, inlineCode: ({ language, value }) => { return ( @@ -268,23 +264,23 @@ const renderers = { }, strong: ({ children }) => { return ( - + {children} ); }, emphasis: ({ children }) => { return ( - + {children} - - ) + + ); }, blockquote: ({ children, depth, tall, ...rest }) => { - if(depth > 1) { + if (depth > 1) { return children; } - + return ( { return ( - + {props.children} ); @@ -355,7 +357,7 @@ const renderers = { ); }, 'graph-mention': ({ ship }) => , - 'image': ({ url }) => ( + image: ({ url }) => ( @@ -379,17 +381,19 @@ const renderers = { ); }, root: ({ tall, children }) => - tall - ? - {children} - - : {children}, + tall ? ( + + {children} + + ) : ( + {children} + ), text: ({ value }) => ( <> - {value.split('\n').map((v,idx) => ( + {value.split('\n').map((v, idx) => ( {idx !== 0 ?
: null} {v} @@ -412,7 +416,13 @@ export function Graphdown( const Renderer = renderers[ast.type] ?? (() => `unknown element: ${type}`); return ( - + {children.map((c) => (