Skip to content

Store screenshot annotations in tutorial's markdown file #12

Description

@lassoan

The annotation editor should read the list of annotated screenshots from the tutorial text (markdown file).

For example, the SlicerFourMinuteTutorial.md file can contain screenshots like this: https://github.com/SlicerLatinAmerica/TestSlicerTutorials/blob/8d702775d8db9c30e52c91bfc8576505ea81bc01/Tutorials/FourMinuteTutorial/FourMinuteTutorial.md?plain=1#L46-L54

If the editor finds an image caption starting with Screenshot: then the annotation editor should add that image to its image list. The annotation editor should also read the list of annotations from the caption and apply it to the screenshot. For example, this image is in the markdown file:

![Screenshot:({"annotation":"click","widget":"toolbar/layouts","label":"1"},{"annotation":"click","widget":"toolbar/layouts/conventional","label":"2"})](Screenshots/en-US/002-part1-after-scene-load.png)

Then the image caption can be parsed with this very simple code:

imageCaption = 'Screenshot:({"annotation":"click","widget":"toolbar/layouts","label":"1"},{"annotation":"click","widget":"toolbar/layouts/conventional","label":"2"})'

screenshotPrefix = "Screenshot:"
if imageCaption.startswith(screenshotPrefix):
    annotations = eval(imageCaption.removeprefix(screenshotPrefix))

annotation now contains the list of annotations and its arguments:

annotation = (
    {'annotation': 'click', 'widget': 'toolbar/layouts', 'label': '1'},
    {'annotation': 'click', 'widget': 'toolbar/layouts/conventional', 'label': '2'}
)

After the annotation is edited in the annotation editor, the editor should write the modified annotations back into the markdown file.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions