MacDownApp / MacDownApp/macdown
Add selectedMarkdown, contentChanged and undo to plugin interface.
Nobody has claimed this yet.
- Dominant language
- Rich Text Format
- Stars
- 9.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I implemented an experimental Swift-based plugin for MacDown 0.6.4 called [MacDownTinkerPlugin](https://github.com/marc-medley/MacDownTinkerPlugin).
From this implementation my observations were:
1. Swift needs to access the MacDown markdown text with document.value(forKey: "markdown") as? String. (See document.attributeKeys for the other keys.)
2. Changing the `markdown` content via the plugin does write to the document markdown editor content.
3. Changing the `markdown` content via the plugin does not have an undo.
4. Changing the `markdown` content via the plugin does not have the document transition to a needs-to-be-saved state.
5. `isDocumentEdited` is currently read only, so the plugin cannot directly mark the document as changed.
6. The `html` does not re-render without either making a subsequent manual markdown edit, or selecting the menu item View > Render HTML.
7. Writing to the `fileURL` does not automatically update into the markdown editor.
8. Did not see an implemented mechanism for processing only the selected markdown text.
Some limitation may have been due to how the Swift plugin was interfacing the with MacDown.
After looking at the MacDown code, it would appear that the MacDown plugin interface could be improve be added to the interface as follows...
* selected markdown: change and write to just the editor selection
* document changed via `markdown`: some way to tell the document that the content was edited. this should also re-render the HTML.
* undo: some way to revert to the pre-plugin activation state. revert from file would be OK, if the document was aware that the content was changed and a `Revert from disk` was active.
* document changed via `fileURL`: some way to invoke a refresh after writing to `fileURL` would also be helpful. (Including clearing and reloading any image cache.) This last option would understandably not have undo via revert from disk.
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the MacDown plugin interface and the document properties mentioned: markdown, fileURL, isDocumentEdited, and attributeKeys. Define separate completion criteria for selected-markdown editing, change tracking and HTML rendering, undo, and fileURL refresh before implementing any interface changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, swift
- Domain
- desktop, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100