@@ -8,6 +8,7 @@ Status: **Proposed**
8
8
<dt>Contributors</dt>
9
9
<dd>@eemeli</dd>
10
10
<dd>@aphillips</dd>
11
+ <dd>@stasm</dd>
11
12
<dt>First proposed</dt>
12
13
<dd>2023-09-05</dd>
13
14
<dt>Pull Request</dt>
@@ -220,3 +221,51 @@ Rendered as React this could become:
220
221
_ What other solutions are available?_
221
222
_ How do they compare against the requirements?_
222
223
_ What other properties they have?_
224
+
225
+ ### HTML-like syntax
226
+
227
+ The goal of this solution is to avoid adding new sigils to the syntax.
228
+ Instead, it leverages the familiarity of the ` foo ` ...` /foo ` idiom,
229
+ inspired by HTML and BBCode.
230
+
231
+ This solution consists of adding new placeholder syntax:
232
+ ` {foo} ` , ` {/foo} ` , and ` {foo/} ` .
233
+
234
+ ```
235
+ This is {html:strong}bold{/html:strong} and this is {html:img alt=|an image|/}.
236
+ ```
237
+
238
+ Markup names are * effectively namespaced* due to their not using any sigils;
239
+ they are distinct from ` $variables ` , ` :functions ` , and ` |literals| ` .
240
+
241
+ > [ !NOTE]
242
+ > This requires dropping unquoted literals as operands,
243
+ > so that ` {foo} ` is not parsed as ` {|foo|} ` .
244
+ > See [ #518 ] ( https://github.com/unicode-org/message-format-wg/issues/518 ) .
245
+
246
+ The exact meaning of the new placeholer types is as follows:
247
+
248
+ * ` {foo} ` is a span-open.
249
+ * ` {/foo} ` is a span-close.
250
+ * ` {foo/} ` is a standalone element.
251
+
252
+ #### Pros
253
+
254
+ * Doesn't add new sigils except for ` / ` ,
255
+ which is universally known thanks to the wide-spread use of HTML.
256
+
257
+ * Using syntax inspired by HTML makes it familiar to most translators.
258
+ Prior art for a similar inspiration can be found in the [ BBCode] ( https://en.wikipedia.org/wiki/BBCode ) syntax,
259
+ which uses ` [foo] ` and ` [/foo] ` as tags.
260
+ Despite being a niche language, BBCode can be argued to be many people's first introduction to markup-like syntax.
261
+
262
+ * Avoids the issues of using JSX-style syntax, ` <foo> ` ...` </foo> ` ,
263
+ which looks * exactly* like HTML, but has different semantics and behavior.
264
+
265
+ #### Cons
266
+
267
+ * May still be confusing because it looks almost like HTML, but doesn't use the familiar angle brackets.
268
+
269
+ * Requires changes to the existing MF2 syntax: dropping unquoted literals as expression operands.
270
+
271
+ * Regular placeholders, e.g. ` {$var} ` , use the same ` {...} ` syntax, and may be confused for * open* elements.
0 commit comments