winston
winston copied to clipboard
[FR] Preview toggle for markdown formatting
Is your feature request related to a problem? Please describe. Often times when writing a post I might use a lot of markup. Currently I cannot preview the rendered markup to see how tables, links, headers, formatting, etc look.
Describe the solution you'd like Would like the ability to preview my post before making it. With maybe a button that essentially toggles the existing
MDEditor(text: $textWrapper.replyText)
Showing:
Text(textWrapper.replyText)
I.e. pseudo:
var body: some View {
VStack {
HStack {
Button(action: {
isPreview.toggle()
}) {
Text(isPreview ? "Edit" : "Preview")
}
Spacer()
}
.padding()
if isPreview {
ScrollView {
Text(textWrapper.replyText)
.padding()
}
} else {
MDEditor(text: $textWrapper.replyText)
}
}
}
With textWrapper.replyText
containing:
**bold** text (link)[link].
We get a preview window:
bold text link
https://github.com/lo-cafe/winston/blob/main/winston/components/Modals/ReplyModal.swift
Describe alternatives you've considered Posting my comment, then editing it if I see a formatting issue.
Additional context
Here’s how another client does something similar:
I might do a PR, but don’t have a Mac to test so need to figure something out.