Wiki

A Wiki page requires a title, markdown and an owner object and can also include images.

Creating a Wiki

from synapseclient import Wiki

entity = syn.get('syn123456')

content = """
# My Wiki Page

Here is a description of my **fantastic** project!

An attached image:
${image?fileName=logo.png&align=none}
"""

wiki = Wiki(title='My Wiki Page',
            owner=entity,
            markdown=content,
            attachments=['/path/to/logo.png'])

wiki = syn.store(wiki)

Embedding images

Note that in the above example, we’ve attached a logo graphic and embedded it in the web page.

Figures that are more than just decoration can be stored as Synapse entities allowing versioning and provenance information to be recorded. This is a better choice for figures with data behind them.

Updating a Wiki

entity = syn.get('syn123456')
wiki = syn.getWiki(entity)

wiki.markdown = """
# My Wiki Page

Here is a description of my **fantastic** project! Let's
*emphasize* the important stuff.

An embedded image that is also a Synapse entity:
${image?synapseId=syn1824434&align=None&scale=66}

Now we can track it's provenance and keep multiple versions.
"""

wiki = syn.store(wiki)

Wiki Class

class synapseclient.wiki.Wiki(**kwargs)

Represents a wiki page in Synapse with content specified in markdown.

Parameters
  • title – Title of the Wiki

  • owner – Parent Entity that the Wiki will belong to

  • markdown – Content of the Wiki (cannot be defined if markdownFile is defined)

  • markdownFile – Path to file which contains the Content of Wiki (cannot be defined if markdown is defined)

  • attachments – List of paths to files to attach

  • fileHandles – List of file handle IDs representing files to be attached

  • parentWikiId – (optional) For sub-pages, specify parent wiki page

__init__(**kwargs)

Initialize self. See help(type(self)) for accurate signature.