lo-cafe / winston

A beautiful and native Reddit client for iOS
https://winston.cafe/
GNU General Public License v3.0
890 stars 63 forks source link

[FR] Preview toggle for markdown formatting #516

Open taylorcox75 opened 1 month ago

taylorcox75 commented 1 month ago

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: IMG_9837 IMG_9838 I might do a PR, but don’t have a Mac to test so need to figure something out.

linear[bot] commented 1 month ago

WIN-164 [FR] Preview toggle for markdown formatting