From ca3269cbb334dd33916802af217c5a0a88fe67ba Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 9 Dec 2016 15:30:21 +0100 Subject: display markdown help --- it/it-tests/src/test/java/it/ui/UiTest.java | 10 ++ .../src/main/js/app/components/MarkdownHelp.js | 131 +++++++++++++++++++++ .../src/main/js/app/utils/startReactApp.js | 3 + 3 files changed, 144 insertions(+) create mode 100644 server/sonar-web/src/main/js/app/components/MarkdownHelp.js diff --git a/it/it-tests/src/test/java/it/ui/UiTest.java b/it/it-tests/src/test/java/it/ui/UiTest.java index a2e71ebc4ef..497770eb7e1 100644 --- a/it/it-tests/src/test/java/it/ui/UiTest.java +++ b/it/it-tests/src/test/java/it/ui/UiTest.java @@ -113,6 +113,16 @@ public class UiTest { .shouldHave(text("1 active rules")); } + @Test + public void markdown_help() { + String tags[] = {"strong", "a", "ul", "ol", "h1", "code", "pre", "blockquote"}; + + nav.open("/markdown/help"); + for (String tag : tags) { + $(tag).shouldBe(visible); + } + } + private static void analyzeSampleProject() { ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } diff --git a/server/sonar-web/src/main/js/app/components/MarkdownHelp.js b/server/sonar-web/src/main/js/app/components/MarkdownHelp.js new file mode 100644 index 00000000000..835b8e0cd72 --- /dev/null +++ b/server/sonar-web/src/main/js/app/components/MarkdownHelp.js @@ -0,0 +1,131 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +// @flow +import React from 'react'; + +export default class MarkdownHelp extends React.Component { + render () { + return ( +
+

Markdown Syntax

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Write:To display:
*this text is bold*this text is bold
{'http://sonarqube.org'}{'http://sonarqube.org'}
+ [SonarQube™ Home Page](http://www.sonarqube.org) + + SonarQube™ Home Page +
* first item
+ * second item +
+
    +
  • first item
  • +
  • second item
  • +
+
1. first item
+ 1. second item +
+
    +
  1. first item
  2. +
  3. second item
  4. +
+
+ = Heading Level 1
+ == Heading Level 2
+ === Heading Level 3
+ ==== Heading Level 4
+ ===== Heading Level 5
+ ====== Heading Level 6
+
+

Heading Level 1

+

Heading Level 2

+

Heading Level 3

+

Heading Level 4

+
Heading Level 5
+
Heading Level 6
+
``Lists#newArrayList()``Lists#newArrayList()
+ ``
+ // code on multiple lines
+ {'public void foo() {'}
+   {'// do some logic here'}
+ {'}'}
+ `` +
+
+  // code on multiple lines
+  public void foo() {
+  // do some logic here
+}
+
+
+ Standard text
+ > Blockquoted text
+ > that spans multiple lines
+
+

Standard text

+
Blockquoted text
+ that spans multiple lines
+
+
+ ); + } +} diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.js b/server/sonar-web/src/main/js/app/utils/startReactApp.js index 0d22ea04de8..3e1bba4f6ff 100644 --- a/server/sonar-web/src/main/js/app/utils/startReactApp.js +++ b/server/sonar-web/src/main/js/app/utils/startReactApp.js @@ -29,6 +29,7 @@ import SimpleContainer from '../components/SimpleContainer'; import Landing from '../components/Landing'; import ProjectContainer from '../components/ProjectContainer'; import AdminContainer from '../components/AdminContainer'; +import MarkdownHelp from '../components/MarkdownHelp'; import NotFound from '../components/NotFound'; import aboutRoutes from '../../apps/about/routes'; import accountRoutes from '../../apps/account/routes'; @@ -69,6 +70,8 @@ const startReactApp = () => { render(( + + {maintenanceRoutes} -- cgit v1.2.3