레이블이 markdown인 게시물을 표시합니다. 모든 게시물 표시
레이블이 markdown인 게시물을 표시합니다. 모든 게시물 표시

2019년 2월 1일 금요일

[Markdown] Markdown Syntax


Reference : https://www.markdownguide.org/basic-syntax/

Headings

# heading 1
## heading 2
### heading 3
#### heading 4
##### heading 5
###### heading 6

Heading level 1
===============

Heading level 2
---------------

Emphasis

*Emphasis* _Emphasis_ (Italic)
**String** __String__ (Bold)
*__BoldItalic__*
**_BoldItalic_**

List

1. 1) Numbered List
* + - Bullet List

Blockquotes

> Block Quote Level 1
>> Block Quote Level 2

Code

`Code Span`
```
Code Block
```

Table

Left  | Center | Right
:---  | :---:  | ---:
d1 | d2 | d3

Line

--- ___ Horizontal Rule

Link

[Link](http://url.com "Title")

[Reference Link][ID]
[ID]: http://url.com "Reference Definition"

![Image][./image.jpg "Title"]

Paragraphs

To create paragraphs, use a blank line to separate one or more lines of text. You should not indent paragraphs with spaces or tabs.

Line Breaks

To create a line break, end a line with two or more spaces, and then type return.

Escape

CharacterName
\backslash
`tick mark
*asterisk
_underscore
{}curly braces
[]brackets
()parentheses
#pound sign
+plus sign
-minus sign (hyphen)
.dot
!exclamation mark

[Markdown] How to embed PlantUML


1. Process File


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
32
33
34
35
36
public static int processFile(File inFile, File outDir, String outFilePrefix, FileFormat outFormat) 
        throws IOException, InterruptedException {

    final Option option = new Option(); 
    if (inFile.exists() == false) {
            throw new IllegalArgumentException();
    }
    FileSystem.getInstance().setCurrentDir(inFile.getAbsoluteFile().getParentFile());
    BlockUmlBuilder builder = new BlockUmlBuilder(
            new ArrayList<String>(), //option.getConfig(),  
            "UTF-8", //option.getCharset(), 
            createEmpty(), //option.getDefaultDefines(file), 
            new InputStreamReader(new FileInputStream(inFile), "UTF-8"),
            inFile.getAbsoluteFile().getParentFile(), 
            inFile.getName());      

    //final List<GeneratedImage> result = new ArrayList<>();
    int count = 0;
    for (BlockUml blockUml : builder.getBlockUmls()) {    
        final Diagram system;
        try {
            system = blockUml.getDiagram();
            final List<FileImageData> exportDiagrams = PSystemUtils.exportDiagrams(system, 
                SuggestedFile.fromOutputFile(new File(outDir, outFilePrefix  + count) , outFormat, 0),
                new FileFormatOption(outFormat),
                false);
            if (exportDiagrams.size() > 1) {
                    exportDiagrams.size();
            }    
            count++;
        } catch (Throwable t) {
            return 0;
        }
    }     
    return count;
}



[Markdown] Mermaid Examples


1. Mermaid Flowchart (1)

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="script/mermaid.css" />
<script src="script/mermaid.min.js"></script>
</head>
<body>
<div class="mermaid">
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C ==>|Two| E["iPhone #9829;"]
D --- E
C -.->|Three| F[fa:fa-car Car]
F -. Loop .-> B
</div>
</body>
</html>


Output:



2. Mermaid Flowchart (1)


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/mermaid/7.0.0/mermaid.css" rel="stylesheet"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/7.0.0/mermaid.js"></script>
</head>
<body>
    <div class="mermaid">
        graph LR
            A-->B
            B-->C
            C-->A
            D-->C
    </div>
</body>
</html>


Output:





[Markdown] Vega-Lite Examples


1. Vega-Lite Bar Chart Example (1)

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
  <head>
    <title>Vega-Lite Bar Chart</title>
    <meta charset="utf-8" />

    <script src="https://cdn.jsdelivr.net/npm/vega@4.4.0/build/vega.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vega-lite@3.0.0-rc12/build/vega-lite.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vega-embed@3.29.1/build/vega-embed.js"></script>

    <style media="screen">
      /* Add space between Vega-Embed links  */
      .vega-actions a {
        margin-right: 5px;
      }
    </style>
  </head>
  <body>
    <h1>Template for Embedding Vega-Lite Visualization</h1>
    <!-- Container for the visualization -->
    <div id="vis"></div>

    <script>
      // Assign the specification to a local variable vlSpec.
      var vlSpec = {
        $schema: 'https://vega.github.io/schema/vega-lite/v3.json',
        data: {
          values: [
            {a: 'C', b: 2},
            {a: 'C', b: 7},
            {a: 'C', b: 4},
            {a: 'D', b: 1},
            {a: 'D', b: 2},
            {a: 'D', b: 6},
            {a: 'E', b: 8},
            {a: 'E', b: 4},
            {a: 'E', b: 7}
          ]
        },
        mark: 'bar',
        encoding: {
          y: {field: 'a', type: 'nominal'},
          x: {
            aggregate: 'average',
            field: 'b',
            type: 'quantitative',
            axis: {
              title: 'Average of b'
            }
          }
        }
      };

      // Embed the visualization in the container with id `vis`
      vegaEmbed('#vis', vlSpec);
    </script>
  </body>
</html>


Output:



2. Vega-Lite Bar Chart Example (2)


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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script src="script/vega.js"></script>
  <script src="script/vega-lite.js"></script>
  <script src="script/vega-embed.js"></script>
  <style media="screen">
      /* Add space between Vega-Embed links  */
      .vega-actions a {
        margin-right: 5px;
      }
  </style>
  <script>
    function readSingleFile(e) {
    var file = e.target.files[0];
    if (!file) {
      return;
    }
    var reader = new FileReader();
    reader.onload = function(e) {
      var contents = e.target.result;
      displayContents(contents);
    };
      reader.readAsText(file);
    }
  </script>
</head>

<body>  
  <div id="vis"></div>
  
  <script>
  var spec = //readSingleFile("vega_demo_2.json");
  {
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "description": "A simple bar chart with embedded data.",
  "width": 360,
  "data": {
    "values": [
      {"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
      {"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
      {"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "a", "type": "ordinal"},
    "y": {"field": "b", "type": "quantitative"},
    "tooltip": {"field": "b", "type": "quantitative"}
  }
  };
  vegaEmbed('#vis', spec)
  </script>
</body>
</html>

Output:



3. Vega-Lite Line Chart Example 


1
"mark": "line",

Output:


4. Vega-Lite Area Chart Example 


1
"mark": "area",

Output: