Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Automatically format a string into boxes for documentation purposes
ResourceFunction["StringTemplateInput"]["string"] converts "string" into boxes with automatic formatting intended for documentation notebooks. |
Convert a string into formatted boxes:
| In[1]:= |
| Out[1]= |
View the result:
| In[2]:= |
| Out[2]= |
Use some special formatting markup:
| In[3]:= |
| Out[3]= |
Automatically link to documentation pages when appropriate:
| In[4]:= |
| Out[4]= |
Some strings will result in documentation links to non-symbol pages:
| In[5]:= |
| Out[5]= |
| In[6]:= |
| Out[6]= |
StringTemplateInput is similar to the resource function StringToBoxes:
| In[7]:= |
| Out[7]= |
| In[8]:= |
| Out[8]= | ![]() |
StringToBoxes formats as if the characters were typed literally:
| In[9]:= |
| Out[9]= |
StringTemplateInput applies heuristics to automatically format some expressions:
| In[10]:= |
| Out[10]= |
Output cells do not typically show string characters:
| In[11]:= |
| Out[11]= |
Use ShowStringCharacters→True to force quotes to appear:
| In[12]:= |
| Out[12]= |
When ambiguous, StringTemplateInput guesses which documentation page to target for links and is unaware of context:
| In[13]:= |
| Out[13]= |
In this case, "Country" linked to the documentation page for the entity type, and not the interpreter type. In these cases, it may be better to manually construct the desired link:
| In[14]:= |
| Out[14]= |
Create your very own Template Input button that can be used in any notebook:
| In[15]:= | ![]() |
| Out[15]= |
Select the following text and click the button to test it: f[x$1,x$2,$$]
This work is licensed under a Creative Commons Attribution 4.0 International License