List of Macros

The following macros work when encased in curly braces. Parameters values follow the macro name, separated by colons. Escape special characters such as "[" and "{" within your macro text using a backslash. For example, {list-of-macros} was used to create the following table:

Macro000000DescriptionParameters
anchorAnchor Tagname: The target anchor name.
Example: {anchor:name=section1}
apiGenerates links to Java or Ruby API documentation.1: class name, e.g. java.lang.Object or java.lang.Object@Java131
2: mode, e.g. Java12, Ruby, defaults to Java (optional)
api-docsDisplays a list of known online API documentations and mappings.none
asinGenerates links to DVD/CD dealers or comparison services. Configuration is read from conf/asinservices.txt1: asin number
codeDisplays a chunk of code with syntax highlighting, for example Java, XML and SQL. The none type will do nothing and is useful for unknown code types.1: syntax highlighter to use, defaults to java (optional)
commentWraps comment text (which will not appear on the rendered wiki page).none
divWraps content in a div tag with an optional CSS class and/or style specified.class: the CSS class that should be applied to this tag.
style: the CSS style that should be applied to this tag.

Example: {div:class=bluebox}...{div}
file-pathDisplays a file system path. The file path should use slashes. Defaults to windows.1: file path
h1Wraps content in a h1 tag with an optional CSS class and/or style specified.class: the CSS class that should be applied to this tag.
style: the CSS style that should be applied to this tag.
helloSay hello example macro.1: name to print
imageDisplays an image file.img: the path to the image.
alt: alt text (optional)
align: alignment of the image (left, right, flow-left, flow-right) (optional)

Example: {image:img=http://www.target_domain.com/images/logo.gif|align=right}
inter-wikiDisplays a list of known InterWiki mappings.none
isbnGenerates links to book dealers or comparison services. Configuration is read from conf/bookservices.txt.1: isbn number
labkeyBase LabKey macro, used for including data from the LabKey Server portal into wikis.tree : renders a LabKey navigation menu.
treeId: the id of the menu to render can be one of the following: core.projects, core.CurrentProject, core.projectAdmin, core.folderAdmin, core.SiteAdmin
linkGenerate a weblink. 
list-of-macrosDisplays a list of available macros. 
mailtoDisplays an email address.1: mail address
new-tab-linkDisplays a link that opens in a new tab.1. Text to display
2. Link to open in a new tab.

Example: {new-tab-link:DisplayText:http://www.google.com}
quoteDisplays quotations.1: The source for the quote (optional)
2: Displayed description, default is Source (optional)

Example: {quote:http://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm|Link}Four score and seven years ago{quote}
rfcGenerates links to RFCs. 
spanWraps content in a span tag with an optional CSS class and/or style specified. Also supports Font Awesome icons.class: the CSS class that should be applied to this tag.
style: the CSS style that should be applied to this tag.

Example: {span:class=fa fa-arrow-right}{span}
tableDisplays a table.none
xrefGenerates links to Java Xref source code.1: class name, e.g. java.lang.Object or java.lang.Object@Nanning
2: line number (optional)

Example: Using the Code Formatting Macro

Encase text that you wish to format as code between two {code} tags. For example,

{code:java}
// Hello World in Java

class HelloWorld {
static public void main( String args[] ) {
System.out.println( "Hello World!" );
}
}
{code}

Using "code:java" specifies that the Java formatting option should be used, the default behavior. The above will render as:

// Hello World in Java

class HelloWorld {
static public void main( String args[] ) {
System.out.println( "Hello World!" );
}
}

LabKey Macro

Displays a variety of menus on the server. For example:

{labkey:tree|core.currentProject}

displays the folders in the Documentation project:

Documentation
Archive
Documentation: Version 19.1
Documentation: Version 18.3
Documentation Version: 18.2
Documentation: Version 18.1
Documentation: Version 17.3
Documentation: Version 17.2
Documentation: Version 17.1
Documentation: Version 16.3
Documentation: Version 16.2
Documentation: Version 16.1
Documentation: Version 15.3
Documentation: Version 15.2
Documentation: Version 15.1
Documentation: Version 14.3
Documentation: Version 14.2
Documentation: Version 14.1
Documentation: Version 13.3
Documentation: Version 13.2
Documentation: Version 13.1
Documentation: Version 12.3
Documentation: Version 12.2
Documentation: Version 12.1
Documentation: Version 11.3
Documentation: Version 11.2
Documentation: Version 11.1
Documentation: Version 10.3
Documentation: Version 10.2
Documentation: Version 10.1
Documentation: Version 9.3
Documentation: Version 9.2
Documentation: Version 9.1
Documentation: Version 8.3
Documentation: Version 8.2
Documentation: Version 8.1
2.3
2.2
2.1
2.0
1.7
1.6
1.5
1.4
1.3
1.1
Drafts
Ancient Archive

Possible values:

{labkey:tree|core.projects}
{labkey:tree|core.currentProject}
{labkey:tree|core.projectAdmin}
{labkey:tree|core.folderAdmin}
{labkey:tree|core.siteAdmin}

Example: Strike Through

The following wiki code...

{span:style=text-decoration:line-through}
Strike through this text.
{span}

...renders text with a line through it.

Strike through this text.

Example: Using the {div} Macro to Apply Inline CSS Styles

The {div} macro lets you inject arbitrary CSS styles into your wiki page, either as an inline CSS style, or as a class in a separate CSS file.

The following example demonstrates injecting inline CSS styles to the wiki code.

The following wiki code...

{div:style=background-color: #FCAE76;
border:1px solid #FE7D1F;
padding-left:20px; padding-right:15px;
margin-left:25px; margin-right:25px}

- list item 1
- list item 2
- list item 3

{div}

...renders in the browser as shown below:

  • list item 1
  • list item 2
  • list item 3

Example: Using the {div} Macro to Apply CSS Classes

To apply a CSS class in wiki code, first create a CSS file that contains your class:

.bluebox { 
background-color: #E7EFF4;
border:1px solid #dee0e1;
padding: 10px 13px;
margin: 10px 20px;
}

Then upload this CSS file to your LabKey Server as a custom stylesheet.

To install at the site level (applies to all projects):

  • Select (Admin) > Site > Admin Console.
  • On the Admin Console Links tab, click Look and Feel Settings.
  • Click the Resources tab and use the "Custom stylesheet" section to see any current custom stylesheet or replace with a new one.
To install at the project level (overriding any site-level stylesheet):
  • Select (Admin) > Folder > Project Settings.
  • Click the Resources tab and use the "Custom stylesheet" section to see any current custom stylesheet or replace with a new one.
Finally, refer to your CSS class with a wrapper {div}:

{div:class=bluebox}
Some text in an instruction box:

- list item 1
- list item 2
- list item 3
{div}

And it will appear in your wiki as:

Some text in an instruction box:
  • list item 1
  • list item 2
  • list item 3

Example: Using the {anchor} Macro

To define a target anchor:

{anchor:someName}

To link to the target anchor within the same document:

[Link to anchor|#someName]

To link to the target anchor in another document, where the document name is docName.

[Link to anchor|docName#someName]

Example: Colored Text Inline

  • To create
    RED TEXT
    :
{div:style=color:red;display:inline-block}RED TEXT{div}

Example: Image Float

{span:style=float:right}[emoji.jpg]{span}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Discussion

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand all collapse all