From 009bac40f8f7983b11473f9c1f792057dbcb379a Mon Sep 17 00:00:00 2001 From: Kelly Ma Date: Fri, 25 Jun 2021 11:25:21 -0400 Subject: [PATCH 1/2] Add documentation for explicit string interpolation --- ...language_explicit_string_interpolation.mdx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 misc_docs/syntax/language_explicit_string_interpolation.mdx diff --git a/misc_docs/syntax/language_explicit_string_interpolation.mdx b/misc_docs/syntax/language_explicit_string_interpolation.mdx new file mode 100644 index 000000000..8792d0936 --- /dev/null +++ b/misc_docs/syntax/language_explicit_string_interpolation.mdx @@ -0,0 +1,34 @@ +--- +id: "explicit-string-interpolation" +keywords: ["string", "interpolation"] +name: "``" +summary: "This is the explicit `string` interpolation syntax." +category: "languageconstructs" +--- + +An explicit `string` interpolation is composed of two backticks. It works like JavaScript's backtick string interpolation without the need to escape special characters. + +### Example + + + +```res +let language = "ReScript" + +let exclamation = `${language} is pretty cool. +Right? +šŸŽ‰ +` +``` + +```js +var language = "ReScript"; + +var exclamation = language + " is pretty cool.\nRight?\nšŸŽ‰\n"; +``` + + + +### References + +* [String interpolation](/docs/manual/latest/primitive-types#string-interpolation) From 13ae014d89422478c8242c0616f9fa95846d08a9 Mon Sep 17 00:00:00 2001 From: Kelly Ma Date: Sat, 31 Jul 2021 10:17:05 -0400 Subject: [PATCH 2/2] Apply review comments --- ..._interpolation.mdx => language_string_interpolation.mdx} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename misc_docs/syntax/{language_explicit_string_interpolation.mdx => language_string_interpolation.mdx} (63%) diff --git a/misc_docs/syntax/language_explicit_string_interpolation.mdx b/misc_docs/syntax/language_string_interpolation.mdx similarity index 63% rename from misc_docs/syntax/language_explicit_string_interpolation.mdx rename to misc_docs/syntax/language_string_interpolation.mdx index 8792d0936..de5f8fc67 100644 --- a/misc_docs/syntax/language_explicit_string_interpolation.mdx +++ b/misc_docs/syntax/language_string_interpolation.mdx @@ -1,12 +1,12 @@ --- -id: "explicit-string-interpolation" +id: "string-interpolation" keywords: ["string", "interpolation"] name: "``" -summary: "This is the explicit `string` interpolation syntax." +summary: "This is the `string interpolation` syntax." category: "languageconstructs" --- -An explicit `string` interpolation is composed of two backticks. It works like JavaScript's backtick string interpolation without the need to escape special characters. +A `string interpolation` is composed of two backticks. It allows Unicode characters and embeddable values and expressions with the `${myValue}` syntax. ### Example