Version at: 23/02/2014, 17:09 vs. version at: 23/02/2014, 17:10 | ||
---|---|---|
1 | 1 | # Sandbox |
2 | 2 | |
3 | 3 | Use this page to experiment with wiki markup. |
4 | 4 | |
5 | 5 | ## Bulleted lists ## |
6 | 6 | Nested bulleted list with two spaces for the second level of indentation and four spaces for the fourth: |
7 | 7 | |
8 | 8 | * a |
9 | 9 | * a.b |
10 | 10 | * a.b.c |
11 | 11 | * a.v |
12 | 12 | * z |
13 | 13 | |
14 | 14 | That list looks correct in the preview and correct in the final presentation. |
15 | 15 | |
16 | 16 | Another list where there are two spaces for each level of indentation: |
17 | 17 | |
18 | 18 | * a |
19 | 19 | * a.b |
20 | 20 | * a.b.c |
21 | 21 | * a.v |
22 | 22 | * z |
23 | 23 | |
24 | 24 | Note that that list looks messed up in the preview, but correct in the final presentation. |
25 | 25 | |
26 | 26 | and one where there are four spaces for each level of indentation: |
27 | 27 | |
28 | 28 | * a |
29 | 29 | * a.b |
30 | 30 | * a.b.c |
31 | 31 | * a.v |
32 | 32 | * z |
33 | 33 | |
34 | 34 | That list looks correct in both the preview and the final presentation. |
35 | 35 | |
36 | 36 | ##Outlines |
37 | 37 | |
38 | 38 | Only two levels of indentation are shown in the "How to Format Text" box, but in reality, more are available: |
39 | 39 | |
40 | 40 | ###Third level of indentation |
41 | 41 | ####Fourth level of indentation |
42 | 42 | #####Fifth level of indentation |
43 | 43 | |
44 | 44 | However, the fifth level looks smaller than body text. |
45 | 45 | |
46 | 46 | ##Code |
47 | 47 | |
48 | 48 | We need a way to present code as-is, so we want to be able to turn off wiki formatting for a block. The "code" markup (a pair of backticks) doesn't do the job. |
49 | 49 | |
50 | 50 | ###Backticks |
51 | 51 | Code sample (note that the format differs between preview mode and final presentation): |
52 | 52 | |
53 | 53 | ` |
54 | 54 | if (a) |
55 | 55 | b |
56 | 56 | else |
57 | 57 | c |
58 | 58 | ` |
59 | 59 | |
60 | 60 | ###Triple backticks |
61 | 61 | |
62 | 62 | This section is "fenced off" by triple backticks (see [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown)): |
63 | 63 | |
64 | 64 | ``` |
65 | 65 | if (a) |
66 | 66 | b |
67 | 67 | else |
68 | 68 | c |
69 | 69 | ``` |
70 | 70 | |
71 | 71 | but the formatting is not preserved. |
72 | 72 | |
73 | 73 | ###Blockquote |
74 | 74 | |
75 | 75 | The blockquote markup doesn't do the job either, since again the format differs between preview mode and final presentation: |
76 | 76 | |
77 | 77 | >>if (a) |
78 | 78 | >> b |
79 | 79 | >>else |
80 | 80 | >> c |
81 | 81 | |
82 | 82 | ###XML-style blockquote tag |
83 | 83 | Here's an attempt to use an XML-style blockquote tag: |
84 | 84 | |
85 | 85 | <blockquote> |
86 | 86 | if (a) |
87 | 87 | b |
88 | 88 | else |
89 | 89 | c |
90 | 90 | </blockquote> |
91 | 91 | |
92 | 92 | The blockquote tag disappears altogether, but does not prevent the text it surrounds from being reformatted. |
93 | 93 | |
94 | 94 | ##Escaping characters |
95 | 95 | |
96 | 96 | We need ways of escaping various characters: |
97 | 97 | |
98 | 98 | ###Underscore |
99 | 99 | Mention a name that contains a single underscore: |
100 | 100 | |
101 | 101 | a_b |
102 | 102 | |
103 | 103 | It appears correctly. But mention a name that contains an underscore twice: |
104 | 104 | |
105 | 105 | a_b a_b |
106 | 106 | |
107 | 107 | It appears as: |
108 | 108 | |
109 | 109 | ab ab |
110 | 110 | |
111 | 111 | where the first b and the second a are italicized. |
112 | 112 | |
113 | 113 | Solution: Use a backslash in front of each underscore: |
114 | 114 | |
115 | 115 | a\\\_b a\\\_b |
116 | 116 | |
117 | 117 | to produce this output: |
118 | 118 | |
119 | 119 | a\_b a\_b |
120 | 120 | |
121 | 121 | ###Parenthesis |
122 | 122 | |
123 | 123 | Say that I want to write this, but in a help section, so I don't want to trigger interpretation as an actual link. Here, I've included spaces to throw off interpretation, but I want to be able to accomplish that through escape sequences instead. |
124 | 124 | |
125 | 125 | [ t e x t ] ( h t t p : / / example . com ) |
126 | 126 | |
127 | 127 | Solution: put a backslash before the open-square-bracket and before the open-parenthesis and close-parenthesis. (Putting a backslash before the close-square-bracket is optional.) |
128 | 128 | |
129 | 129 | \\[text\\]\\(http://example.com\\) |
130 | 130 | |
131 | 131 | Output: |
132 | 132 | |
133 | 133 | \[text\]\(http://example.com\) |
134 | 134 | |
135 | 135 | ##Bookmarklet code |
136 | 136 | First bookmarklet test (which succeeds in both preview and presentation modes): |
137 | 137 | |
138 | 138 | [test][1] |
139 | 139 | |
140 | 140 | [1]: javascript:var%20p=Math.floor((Math.random()*100)+1);location.href=%22http://tatoeba.org/eng/sentences/show_all_in/epo/und/eng/indifferent/page:%22+p; |
141 | 141 | |
142 | 142 | |
143 | 143 | Second bookmarklet test (which succeeds only in preview mode): |
144 | 144 | |
145 | 145 | [test 2a](javascript:var%20u%20=%20%22%22;var%20e=window.prompt%28%22Enter%20URL%20or%20number%20of%22+%22%20sentence%20to%20link%20to%20this%20one%22,%22%22%29;if%28e!=null%29{var%20r=/%28http:\/\/%5B^\/%5D+\/%5Ba-z%5D{3}\/%29?%28sentences\/show\/%29?%28%5B1-9%5D%5B0-9%5D%29%28#.%29?/;var%20em=e.match%28r%29;if%28em!=null%29{var%20h=location.href;var%20hm=h.match%28r%29;u=hm%5B1%5D+%22links/add/%22+hm%5B3%5D+%22/%22+em%5B3%5D;location.href=u;}else{alert%28%22Invalid%20input.%22%29};}) |
146 | 146 | |
147 | 147 | Third bookmarklet test (which succeeds only in preview mode; in presentation mode it points to http://en.wiki.tatoeba.org/articles/show/sandbox): |
148 | 148 | |
149 | 149 | [test 2][2] |
150 | 150 | |
151 | 151 | [2]: |
152 | 152 | javascript:var%20u%20=%20%22%22;var%20e=window.prompt%28%22Enter%20URL%20or%20number%20of%22+%22%20sentence%20to%20link%20to%20this%20one%22,%22%22%29;if%28e!=null%29{var%20r=/%28http:\/\/%5B^\/%5D+\/%5Ba-z%5D{3}\/%29?%28sentences\/show\/%29?%28%5B1-9%5D%5B0-9%5D%29%28#.%29?/;var%20em=e.match%28r%29;if%28em!=null%29{var%20h=location.href;var%20hm=h.match%28r%29;u=hm%5B1%5D+%22links/add/%22+hm%5B3%5D+%22/%22+em%5B3%5D;location.href=u;}else{alert%28%22Invalid%20input.%22%29};} |
153 | 153 | |
154 | 154 | Fourth bookmarklet test (which fails in both preview mode and presentation mode; in presentation mode it points to http://en.wiki.tatoeba.org/articles/show/sandbox): |
155 | 155 | |
156 | 156 | [test 3][3] |
157 | 157 | |
158 | 158 | [3]: |
159 | 159 | javascript:var%20u%20=%20"";var%20e=window.prompt("Enter%20URL%20or%20number%20of" +"%20sentence%20to%20link%20to%20this%20one","");if(e!=null){var%20r=/(http:\/\/[^\/]+\/[a-z]{3}\/)?(sentences\/show\/)?([1-9][0-9])(#.)?/;var%20em=e.match(r);if(em!=null){var%20h=location.href;var%20hm=h.match(r);u=hm1+"links/add/"+hm[3]+"/"+em[3];location.href=u;}else{alert("Invalid%20input.")};} |
diff view generated by jsdifflib |
Version at: 23/02/2014, 17:09
# Sandbox Use this page to experiment with wiki markup. ## Bulleted lists ## Nested bulleted list with two spaces for the second level of indentation and four spaces for the fourth: * a * a.b * a.b.c * a.v * z That list looks correct in the preview and correct in the final presentation. Another list where there are two spaces for each level of indentation: * a * a.b * a.b.c * a.v * z Note that that list looks messed up in the preview, but correct in the final presentation. and one where there are four spaces for each level of indentation: * a * a.b * a.b.c * a.v * z That list looks correct in both the preview and the final presentation. ##Outlines Only two levels of indentation are shown in the "How to Format Text" box, but in reality, more are available: ###Third level of indentation ####Fourth level of indentation #####Fifth level of indentation However, the fifth level looks smaller than body text. ##Code We need a way to present code as-is, so we want to be able to turn off wiki formatting for a block. The "code" markup (a pair of backticks) doesn't do the job. ###Backticks Code sample (note that the format differs between preview mode and final presentation): ` if (a) b else c ` ###Triple backticks This section is "fenced off" by triple backticks (see [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown)): ``` if (a) b else c ``` but the formatting is not preserved. ###Blockquote The blockquote markup doesn't do the job either, since again the format differs between preview mode and final presentation: >>if (a) >> b >>else >> c ###XML-style blockquote tag Here's an attempt to use an XML-style blockquote tag: <blockquote> if (a) b else c </blockquote> The blockquote tag disappears altogether, but does not prevent the text it surrounds from being reformatted. ##Escaping characters We need ways of escaping various characters: ###Underscore Mention a name that contains a single underscore: a_b It appears correctly. But mention a name that contains an underscore twice: a_b a_b It appears as: ab ab where the first b and the second a are italicized. Solution: Use a backslash in front of each underscore: a\\\_b a\\\_b to produce this output: a\_b a\_b ###Parenthesis Say that I want to write this, but in a help section, so I don't want to trigger interpretation as an actual link. Here, I've included spaces to throw off interpretation, but I want to be able to accomplish that through escape sequences instead. [ t e x t ] ( h t t p : / / example . com ) Solution: put a backslash before the open-square-bracket and before the open-parenthesis and close-parenthesis. (Putting a backslash before the close-square-bracket is optional.) \\[text\\]\\(http://example.com\\) Output: \[text\]\(http://example.com\) ##Bookmarklet code First bookmarklet test (which succeeds in both preview and presentation modes): [test][1] [1]: javascript:var%20p=Math.floor((Math.random()*100)+1);location.href=%22http://tatoeba.org/eng/sentences/show_all_in/epo/und/eng/indifferent/page:%22+p; Second bookmarklet test (which succeeds only in preview mode): [test 2a](javascript:var%20u%20=%20%22%22;var%20e=window.prompt%28%22Enter%20URL%20or%20number%20of%22+%22%20sentence%20to%20link%20to%20this%20one%22,%22%22%29;if%28e!=null%29{var%20r=/%28http:\/\/%5B^\/%5D+\/%5Ba-z%5D{3}\/%29?%28sentences\/show\/%29?%28%5B1-9%5D%5B0-9%5D%29%28#.%29?/;var%20em=e.match%28r%29;if%28em!=null%29{var%20h=location.href;var%20hm=h.match%28r%29;u=hm%5B1%5D+%22links/add/%22+hm%5B3%5D+%22/%22+em%5B3%5D;location.href=u;}else{alert%28%22Invalid%20input.%22%29};}) Third bookmarklet test (which succeeds only in preview mode; in presentation mode it points to http://en.wiki.tatoeba.org/articles/show/sandbox): [test 2][2] [2]: javascript:var%20u%20=%20%22%22;var%20e=window.prompt%28%22Enter%20URL%20or%20number%20of%22+%22%20sentence%20to%20link%20to%20this%20one%22,%22%22%29;if%28e!=null%29{var%20r=/%28http:\/\/%5B^\/%5D+\/%5Ba-z%5D{3}\/%29?%28sentences\/show\/%29?%28%5B1-9%5D%5B0-9%5D%29%28#.%29?/;var%20em=e.match%28r%29;if%28em!=null%29{var%20h=location.href;var%20hm=h.match%28r%29;u=hm%5B1%5D+%22links/add/%22+hm%5B3%5D+%22/%22+em%5B3%5D;location.href=u;}else{alert%28%22Invalid%20input.%22%29};} Fourth bookmarklet test (which fails in both preview mode and presentation mode; in presentation mode it points to http://en.wiki.tatoeba.org/articles/show/sandbox): [test 3][3] [3]: javascript:var%20u%20=%20"";var%20e=window.prompt("Enter%20URL%20or%20number%20of" +"%20sentence%20to%20link%20to%20this%20one","");if(e!=null){var%20r=/(http:\/\/[^\/]+\/[a-z]{3}\/)?(sentences\/show\/)?([1-9][0-9])(#.)?/;var%20em=e.match(r);if(em!=null){var%20h=location.href;var%20hm=h.match(r);u=hm1+"links/add/"+hm[3]+"/"+em[3];location.href=u;}else{alert("Invalid%20input.")};}
version at: 23/02/2014, 17:10
# Sandbox Use this page to experiment with wiki markup. ## Bulleted lists ## Nested bulleted list with two spaces for the second level of indentation and four spaces for the fourth: * a * a.b * a.b.c * a.v * z That list looks correct in the preview and correct in the final presentation. Another list where there are two spaces for each level of indentation: * a * a.b * a.b.c * a.v * z Note that that list looks messed up in the preview, but correct in the final presentation. and one where there are four spaces for each level of indentation: * a * a.b * a.b.c * a.v * z That list looks correct in both the preview and the final presentation. ##Outlines Only two levels of indentation are shown in the "How to Format Text" box, but in reality, more are available: ###Third level of indentation ####Fourth level of indentation #####Fifth level of indentation However, the fifth level looks smaller than body text. ##Code We need a way to present code as-is, so we want to be able to turn off wiki formatting for a block. The "code" markup (a pair of backticks) doesn't do the job. ###Backticks Code sample (note that the format differs between preview mode and final presentation): ` if (a) b else c ` ###Triple backticks This section is "fenced off" by triple backticks (see [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown)): ``` if (a) b else c ``` but the formatting is not preserved. ###Blockquote The blockquote markup doesn't do the job either, since again the format differs between preview mode and final presentation: >>if (a) >> b >>else >> c ###XML-style blockquote tag Here's an attempt to use an XML-style blockquote tag: <blockquote> if (a) b else c </blockquote> The blockquote tag disappears altogether, but does not prevent the text it surrounds from being reformatted. ##Escaping characters We need ways of escaping various characters: ###Underscore Mention a name that contains a single underscore: a_b It appears correctly. But mention a name that contains an underscore twice: a_b a_b It appears as: ab ab where the first b and the second a are italicized. Solution: Use a backslash in front of each underscore: a\\\_b a\\\_b to produce this output: a\_b a\_b ###Parenthesis Say that I want to write this, but in a help section, so I don't want to trigger interpretation as an actual link. Here, I've included spaces to throw off interpretation, but I want to be able to accomplish that through escape sequences instead. [ t e x t ] ( h t t p : / / example . com ) Solution: put a backslash before the open-square-bracket and before the open-parenthesis and close-parenthesis. (Putting a backslash before the close-square-bracket is optional.) \\[text\\]\\(http://example.com\\) Output: \[text\]\(http://example.com\) ##Bookmarklet code First bookmarklet test (which succeeds in both preview and presentation modes): [test][1] [1]: javascript:var%20p=Math.floor((Math.random()*100)+1);location.href=%22http://tatoeba.org/eng/sentences/show_all_in/epo/und/eng/indifferent/page:%22+p; Second bookmarklet test (which succeeds only in preview mode): [test 2a](javascript:var%20u%20=%20%22%22;var%20e=window.prompt%28%22Enter%20URL%20or%20number%20of%22+%22%20sentence%20to%20link%20to%20this%20one%22,%22%22%29;if%28e!=null%29{var%20r=/%28http:\/\/%5B^\/%5D+\/%5Ba-z%5D{3}\/%29?%28sentences\/show\/%29?%28%5B1-9%5D%5B0-9%5D%29%28#.%29?/;var%20em=e.match%28r%29;if%28em!=null%29{var%20h=location.href;var%20hm=h.match%28r%29;u=hm%5B1%5D+%22links/add/%22+hm%5B3%5D+%22/%22+em%5B3%5D;location.href=u;}else{alert%28%22Invalid%20input.%22%29};}) Third bookmarklet test (which succeeds only in preview mode; in presentation mode it points to http://en.wiki.tatoeba.org/articles/show/sandbox): [test 2][2] [2]: javascript:var%20u%20=%20%22%22;var%20e=window.prompt%28%22Enter%20URL%20or%20number%20of%22+%22%20sentence%20to%20link%20to%20this%20one%22,%22%22%29;if%28e!=null%29{var%20r=/%28http:\/\/%5B^\/%5D+\/%5Ba-z%5D{3}\/%29?%28sentences\/show\/%29?%28%5B1-9%5D%5B0-9%5D%29%28#.%29?/;var%20em=e.match%28r%29;if%28em!=null%29{var%20h=location.href;var%20hm=h.match%28r%29;u=hm%5B1%5D+%22links/add/%22+hm%5B3%5D+%22/%22+em%5B3%5D;location.href=u;}else{alert%28%22Invalid%20input.%22%29};} Fourth bookmarklet test (which fails in both preview mode and presentation mode; in presentation mode it points to http://en.wiki.tatoeba.org/articles/show/sandbox): [test 3][3] [3]: javascript:var%20u%20=%20"";var%20e=window.prompt("Enter%20URL%20or%20number%20of" +"%20sentence%20to%20link%20to%20this%20one","");if(e!=null){var%20r=/(http:\/\/[^\/]+\/[a-z]{3}\/)?(sentences\/show\/)?([1-9][0-9])(#.)?/;var%20em=e.match(r);if(em!=null){var%20h=location.href;var%20hm=h.match(r);u=hm1+"links/add/"+hm[3]+"/"+em[3];location.href=u;}else{alert("Invalid%20input.")};}