View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.doxia.module.markdown;
20  
21  import org.apache.commons.lang3.StringUtils;
22  import org.apache.maven.doxia.markup.TextMarkup;
23  
24  /**
25   * This interface defines all markups and syntaxes used by the <b>Markdown</b> format.
26   */
27  @SuppressWarnings("checkstyle:interfaceistype")
28  public interface MarkdownMarkup extends TextMarkup {
29      // ----------------------------------------------------------------------
30      // Markup separators
31      // ----------------------------------------------------------------------
32  
33      /** backslash markup char: '\\' */
34      char BACKSLASH = '\\';
35  
36      String COMMENT_START = "<!-- ";
37      String COMMENT_END = " -->";
38  
39      String BLANK_LINE = EOL + EOL;
40  
41      /** indentation e.g. for paragraphs inside lists */
42      String INDENT = StringUtils.repeat(String.valueOf(SPACE), 4);
43      // ----------------------------------------------------------------------
44      // Markup syntax
45      // ----------------------------------------------------------------------
46  
47      /** Syntax for the anchor end: "\"&gt;&lt;/a&gt;" */
48      String ANCHOR_END_MARKUP = "\"></a>";
49  
50      /** Syntax for the anchor start: "&lt;a id=\"" */
51      String ANCHOR_START_MARKUP = "<a id=\"";
52  
53      /** Syntax for the bold style end: "**" */
54      String BOLD_END_MARKUP = "**";
55  
56      /** Syntax for the bold style start: "**" */
57      String BOLD_START_MARKUP = "**";
58  
59      /** Syntax for the header start: "---" */
60      String METADATA_MARKUP = StringUtils.repeat(String.valueOf(MINUS), 3);
61  
62      /** Syntax for the horizontal rule: "***" */
63      String HORIZONTAL_RULE_MARKUP = "***";
64  
65      /** Syntax for the italic style end: "_" */
66      String ITALIC_END_MARKUP = "_";
67  
68      /** Syntax for the italic style start: "_" */
69      String ITALIC_START_MARKUP = "_";
70  
71      /** Syntax for the link end: ")" */
72      String LINK_END_MARKUP = ")";
73  
74      /** Syntax for the link start: "[" */
75      String LINK_START_1_MARKUP = "[";
76  
77      /** Syntax for the link start: "](" */
78      String LINK_START_2_MARKUP = "](";
79  
80      /** Syntax for the ordered list item: '1. ' */
81      String LIST_ORDERED_ITEM_START_MARKUP = "1. ";
82  
83      /** Syntax for the unordered list item: "- " */
84      String LIST_UNORDERED_ITEM_START_MARKUP = "- ";
85  
86      /** Syntax for the mono-spaced style end: "`" */
87      String MONOSPACED_END_MARKUP = "`";
88  
89      /** Syntax for the mono-spaced style start: "`" */
90      String MONOSPACED_START_MARKUP = "`";
91  
92      /** Syntax for the verbatim start: "```" */
93      String VERBATIM_START_MARKUP = "```";
94  
95      /** Syntax for the verbatim end: "```" */
96      String VERBATIM_END_MARKUP = "```";
97  
98      /** Syntax for the blockquote start: "&gt; " */
99      String BLOCKQUOTE_START_MARKUP = "> ";
100 
101     /** Syntax for the non breaking space: entity from HTML */
102     String NON_BREAKING_SPACE_MARKUP = "&nbsp;";
103 
104     /** Syntax for the section title start: "#" */
105     String SECTION_TITLE_START_MARKUP = "#";
106 
107     /* Table markup according to https://github.github.com/gfm/#tables-extension- */
108     /** Syntax for the table cell start: "|" */
109     String TABLE_CELL_SEPARATOR_MARKUP = String.valueOf(PIPE);
110 
111     /** Syntax for the table column, left alignment (default): "---" */
112     String TABLE_COL_LEFT_ALIGNED_MARKUP = StringUtils.repeat(String.valueOf(MINUS), 3);
113 
114     /** Syntax for the table column, right alignment: "---:" */
115     String TABLE_COL_RIGHT_ALIGNED_MARKUP = StringUtils.repeat(String.valueOf(MINUS), 3) + COLON;
116 
117     /** Syntax for the table column, center alignment: ":---:" */
118     String TABLE_COL_CENTER_ALIGNED_MARKUP = COLON + StringUtils.repeat(String.valueOf(MINUS), 3) + COLON;
119 
120     /** Syntax for the table row prefix (the other separators in the same row are regular {@link #TABLE_CELL_SEPARATOR_MARKUP} characters) */
121     String TABLE_ROW_PREFIX = String.valueOf(PIPE);
122 }