Blog

  • 2024
  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012

Confluence does not provide an easy way to render definition lists. This is often very annoying for new users who are used to Wikis where support of definition lists is considered a standard.

Definition lists help to render key value pairs in a very concise manner. Values in definition lists are much easier to read than the same values rendered in a table. Especially for a glossary, often included in technical documentation, this is very important.

The Definition List Macro of our free Project Documentation Macros renders a table as a definition list. It provides a couple of styles to choose from, but you my still be not satisfied with any of them. Therefore the macro gives you full control on how to render your list.

In this short article we show you how to adjust the rendering to your requirements.

Find the Stylesheet

You configure the rendering of the definition list with CSS code you add to your stylesheet.

It depends on the theme you use with your Confluence installation, where you find the stylesheet to add your CSS code. For this example we assume that you use the default theme and you want to change the style for a single space only.

To change the stylesheet for a single space, open the the “Stylesheet” tab of the “Space Tools”.

Click “Edit” and you can add your CSS code.

Define your Style

Add the following lines of CSS code to the text area:

dl.mystyle{
}
dl.mystyle > dt {
  font-weight: bold;
}
dl.mystyle > dd {
  margin-left: 1.6em;
}

This CSS code will render the definition data on a new line with a left margin (users of MediaWiki may be familiar with this style).

Configure the Macro

Now change the Definition List CSS Class parameter in the Definition List Macro:

And this is the result of the rendering after you saved your Confluence page:

 

You may choose to never use the default style called “meet”, but prefer your style as the default style. You can get this result by overriding the “meet” style within your stylesheet (as shown above) like this:

dl.meet  {
   padding :   0em ;
}
dl.meet > dt  {
   width :   100% ;
 
   float :   none ;
   clear :   none ;
 
   text-align :   left ;
   font-weight :   bold ;
   color :   black ;
}
dl.meet > dd  {
   margin :   0   0   0   1.6em ;
   padding :   0   0   0   0 ;
}

While writing macros for Confluence I encountered a problem that prevented the wiki to render the page. Without the edit button showing up on the “Oops” page, I first thought that I will never see the contents of the page again. But the story came to a good end!

And without accessing the database …!

The problem was displayed on a full window error message, containing information like

java.lang.RuntimeException: Error rendering template for decorator root
caused by: java.lang.RuntimeException: Error rendering template for decorator page
caused by: com.atlassian.core.exception.InfrastructureException: Error occurred rendering template content
caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLatestVersionsOfAttachments' 
caused by: net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
caused by: net.sf.hibernate.HibernateException: collection was evicted
Caused by: java.lang.RuntimeException: Error rendering template for decorator page
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDisplayableLabel'
...

So without edit button, the contents of the page seemed lost. But it was not.

This is because pages may be called in edit mode with a URL, if you know the page ID:

http://<baseurl>/pages/editpage.action?pageId=<pageID>

And if you do not know the page ID, it is similarly easy by providing the space key and page name:

http://<baseurl>/pages/editpage.action?spaceKey=<spaceKey>&title=pageName

If you want to delete a page or have problem with a blog article, you can also fix the problem using your browser. Editing or Deleting a Page That Won’t Render provides all the information you need. It is written for Confluence 3.5, but also works with Confluence 5.X.