diff --git a/docs/de/user/repo/assets/repository-code-fileViewer.png b/docs/de/user/repo/assets/repository-code-fileViewer.png index f141c07920..4afa726c01 100644 Binary files a/docs/de/user/repo/assets/repository-code-fileViewer.png and b/docs/de/user/repo/assets/repository-code-fileViewer.png differ diff --git a/docs/en/user/repo/assets/repository-code-fileViewer.png b/docs/en/user/repo/assets/repository-code-fileViewer.png index 622e7b0045..c484b2e962 100644 Binary files a/docs/en/user/repo/assets/repository-code-fileViewer.png and b/docs/en/user/repo/assets/repository-code-fileViewer.png differ diff --git a/scm-ui/ui-components/src/SyntaxHighlighter.stories.tsx b/scm-ui/ui-components/src/SyntaxHighlighter.stories.tsx index 305d8dc2c8..7f458e4784 100644 --- a/scm-ui/ui-components/src/SyntaxHighlighter.stories.tsx +++ b/scm-ui/ui-components/src/SyntaxHighlighter.stories.tsx @@ -55,4 +55,9 @@ storiesOf("SyntaxHighlighter", module) + )) + .add("Without line numbers", () => ( + + + )); diff --git a/scm-ui/ui-components/src/SyntaxHighlighter.tsx b/scm-ui/ui-components/src/SyntaxHighlighter.tsx index bcbf05d53d..a8a06ac29d 100644 --- a/scm-ui/ui-components/src/SyntaxHighlighter.tsx +++ b/scm-ui/ui-components/src/SyntaxHighlighter.tsx @@ -30,13 +30,15 @@ import { arduinoLight } from "react-syntax-highlighter/dist/cjs/styles/hljs"; type Props = { language?: string; value: string; + showLineNumbers?: boolean; }; const defaultLanguage = "text"; class SyntaxHighlighter extends React.Component { static defaultProps: Partial = { - language: defaultLanguage + language: defaultLanguage, + showLineNumbers: true }; getLanguage = () => { @@ -48,9 +50,10 @@ class SyntaxHighlighter extends React.Component { }; render() { + const { showLineNumbers } = this.props; const language = this.getLanguage(); return ( - + {this.props.value} ); diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap index 295104f72f..58725b1514 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -39474,6 +39474,22 @@ exports[`Storyshots MarkdownView Code without Lang 1`] = ` } > + + + 1 + + + @@ -40194,6 +40210,120 @@ Deserunt officia esse aliquip consectetur duis ut labore laborum commodo aliquip } } > + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + + + + 10 + + + + 11 + + + + 12 + + + + 13 + + + + 14 + + + + 15 + + + package main @@ -40466,6 +40596,176 @@ exports[`Storyshots MarkdownView Xml Code Block 1`] = ` } > + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + + + + 10 + + + + 11 + + + + 12 + + + + 13 + + + + 14 + + + + 15 + + + + 16 + + + + 17 + + + + 18 + + + + 19 + + + + 20 + + + + 21 + + + + 22 + + + + 23 + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + + + + 10 + + + + 11 + + + + 12 + + + + 13 + + + + 14 + + + + 15 + + + + 16 + + + + 17 + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + + + + 10 + + + + 11 + + + + 12 + + + + 13 + + + + 14 + + + + 15 + + + + 16 + + + + 17 + + + + 18 + + + + 19 + + + + 20 + + + + 21 + + + + 22 + + + + 23 + + + + 24 + + + + 25 + + + + 26 + + + + 27 + + + + 28 + + + + 29 + + + + 30 + + + + 31 + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + + + + 10 + + + + 11 + + + + 12 + + + + 13 + + + + 14 + + + + 15 + + + + 16 + + + + 17 + + + + 18 + + + + 19 + + + + 20 + + + + + +`; + +exports[`Storyshots SyntaxHighlighter Without line numbers 1`] = ` +
+
+    
+      
+        package
+      
+      
+         com.example;
+
+      
+      
+
+      
+        
+      
+      
+        import
+      
+      
+         java.io.IOException;
+
+      
+      
+        
+      
+      
+        import
+      
+      
+         java.io.OutputStream;
+
+      
+      
+        
+      
+      
+        import
+      
+      
+         java.net.InetSocketAddress;
+
+      
+      
+
+      
+        
+      
+      
+        import
+      
+      
+         com.sun.net.httpserver.HttpExchange;
+
+      
+      
+        
+      
+      
+        import
+      
+      
+         com.sun.net.httpserver.HttpHandler;
+
+      
+      
+        
+      
+      
+        import
+      
+      
+         com.sun.net.httpserver.HttpServer;
+
+      
+      
+
+      
+        
+      
+      
+        public
+      
+      
+         
+      
+      
+        class
+      
+      
+         
+      
+      
+        Test
+      
+      
+         
+      
+      
+        {
+
+      
+      
+
+      
+          
+      
+      
+        public
+      
+      
+         
+      
+      
+        static
+      
+      
+         
+      
+      
+        void
+      
+      
+         
+      
+      
+        main
+      
+      
+        (String[] args)
+      
+      
+         
+      
+      
+        throws
+      
+      
+         Exception 
+      
+      
+        {
+
+      
+      
+            HttpServer server = HttpServer.create(
+      
+      
+        new
+      
+      
+         InetSocketAddress(
+      
+      
+        8000
+      
+      
+        ), 
+      
+      
+        0
+      
+      
+        );
+
+      
+      
+            server.createContext(
+      
+      
+        "/test"
+      
+      
+        , 
+      
+      
+        new
+      
+      
+         MyHandler());
+
+      
+      
+            server.setExecutor(
+      
+      
+        null
+      
+      
+        ); 
+      
+      
+        // creates a default executor
+      
+      
+        
+
+      
+          server.start();
+
+        }
+
+      
+
+      
+          
+      
+      
+        static
+      
+      
+         
+      
+      
+        class
+      
+      
+         
+      
+      
+        MyHandler
+      
+      
+         
+      
+      
+        implements
+      
+      
+         
+      
+      
+        HttpHandler
+      
+      
+         
+      
+      
+        {
+
+      
+      
+            
+      
+      
+        @Override
+      
+      
+        
+
+      
+      
+            
+      
+      
+        public
+      
+      
+         
+      
+      
+        void
+      
+      
+         
+      
+      
+        handle
+      
+      
+        (HttpExchange t)
+      
+      
+         
+      
+      
+        throws
+      
+      
+         IOException 
+      
+      
+        {
+
+      
+      
+              String response = 
+      
+      
+        "This is the response"
+      
+      
+        ;
+
+      
+      
+              t.sendResponseHeaders(
+      
+      
+        200
+      
+      
+        , response.length());
+
+      
+            OutputStream os = t.getResponseBody();
+
+            os.write(response.getBytes());
+
+            os.close();
+
+          }
+
+        }
+
+      
+
+      }
+
+      
+