Wiki
synapseclient.wiki
¶
Wiki¶
A Wiki page requires a title, markdown and an owner object and can also include images.
Creating a Wiki¶
import synapseclient
from synapseclient import Wiki
## Initialize a Synapse object & authenticate
syn = synapseclient.Synapse()
syn.login()
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¶
import synapseclient
## Initialize a Synapse object & authenticate
syn = synapseclient.Synapse()
syn.login()
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)
Classes¶
Wiki
¶
Bases: DictObject
Represents a wiki page in Synapse with content specified in markdown.
PARAMETER | DESCRIPTION |
---|---|
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
|
Source code in synapseclient/wiki.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
Functions¶
json()
¶
Returns the JSON representation of the Wiki object.
Source code in synapseclient/wiki.py
129 130 131 |
|
getURI()
¶
For internal use.
Source code in synapseclient/wiki.py
133 134 135 136 |
|
postURI()
¶
For internal use.
Source code in synapseclient/wiki.py
138 139 140 141 |
|
putURI()
¶
For internal use.
Source code in synapseclient/wiki.py
143 144 145 146 |
|
deleteURI()
¶
For internal use.
Source code in synapseclient/wiki.py
148 149 150 151 |
|
update_markdown(markdown=None, markdown_file=None)
¶
Updates the wiki's markdown. Specify only one of markdown or markdown_file
PARAMETER | DESCRIPTION |
---|---|
markdown |
text that will become the markdown
DEFAULT:
|
markdown_file |
path to a file. Its contents will be the markdown
DEFAULT:
|
Source code in synapseclient/wiki.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
WikiAttachment
¶
Bases: DictObject
Represents a wiki page attachment.
Source code in synapseclient/wiki.py
175 176 177 178 179 180 181 |
|