Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Markdown Preview #567

Open
jenslys opened this issue Apr 29, 2022 · 10 comments
Open

✨ Markdown Preview #567

jenslys opened this issue Apr 29, 2022 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@jenslys
Copy link

jenslys commented Apr 29, 2022

Describe the solution you'd like

Would be nice to have a feature where you can preview your markdown(.md) files within CodeEdit.
Preferably matching GitHub's styling. Where you also could switch between dark and light mode.

Example preview from VS CODE:

https://cln.sh/MzuGHDycazmyxGssnWqp

Resources

@jenslys jenslys added the enhancement New feature or request label Apr 29, 2022
@ghost
Copy link

ghost commented May 18, 2022

@jenslys So you mean raw and formatted text? Supporting HTML and Markdown? I can work on something like that. Unfortunately, there are only messy, complicated ways to do this using the SwiftUI WebView, so we might have to add a bit of JavaScript rooted into SwiftUI.

@stale stale bot added the wontfix This will not be worked on label Jul 18, 2022
@CodeEditApp CodeEditApp deleted a comment from stale bot Jul 18, 2022
@stale stale bot removed the wontfix This will not be worked on label Jul 18, 2022
@leon-wolf
Copy link

I you like you can assign me to this issue and i would take a look :)

@austincondiff
Copy link
Collaborator

austincondiff commented Oct 13, 2022

@leon-wolf, I've assigned it to you, but we may consider the following before starting this task:

  1. Should this be an extension (it would still ship with CodeEdit)
  • If yes: can we work on it now in the core and move it into an extension later or should we wait until we have a more solidified Extensions API?
  1. Should the preview be in the same tab or a separate tab?
  • If same tab: should it split the layout within the tab aside from planned editor split layouts?
  • If separate: should we open a split editor if one does not yet exist with the tab open?

Note: Xcode has the concept of the preview canvas within the same tab, so for whatever thats worth.

image

  1. Should the preview be open by default?

  2. For .md files only, .mdx?

  3. Command, menu item, keyboard shortcut to show/hide preview?

  4. Because markdown outputs html, would it be appropriate to render the preview in a webview or do we want to try to parse it as a native view?

  5. Do we want to handle markdown flavors?

CC: @CodeEditApp/maintainers

@austincondiff
Copy link
Collaborator

Here is a potential resource mentioned in Discord

@StefKors
Copy link
Member

StefKors commented Nov 1, 2022

btw Swift UI supports markdown natively like so:

struct Markdown: View {

  var body: some View {
    VStack {
      Text(.init("**Hello** *World*"))
    }
  }

}

For finetuned control of rendering output you can read here how that works: https://developer.apple.com/documentation/swiftui/text/init(_:)-1a4oh

An alternative library can be found here: https://github.com/apple/swift-markdown

@0xWDG
Copy link
Collaborator

0xWDG commented Nov 1, 2022

btw Swift UI supports markdown natively like so:

struct Markdown: View {

  var body: some View {
    VStack {
      Text(.init("**Hello** *World*"))
    }
  }

}

For finetuned control of rendering output you can read here how that works: developer.apple.com/documentation/swiftui/text/init(_:)-1a4oh

An alternative library can be found here: apple/swift-markdown

Yup, but it does not support images, so it is no direct replacement unfortunately.

@jacob-carlborg
Copy link

jacob-carlborg commented Jan 25, 2023

  1. Should this be an extension (it would still ship with CodeEdit)

Probably.

  1. Should the preview be in the same tab or a separate tab?

Ideally configurable.

  1. Should the preview be open by default?

Ideally configurable.

  1. For .md files only, .mdx?

Ideally configurable. In TextMate the user can freely map file extensions to languages. Then all commands are tied to languages and not file extensions. Languages are recognized based of file extensions. Bundles come with a set of preconfigured mappings.

  1. Command, menu item, keyboard shortcut to show/hide preview?

Yes.

  1. Because markdown outputs html, would it be appropriate to render the preview in a webview or do we want to try to parse it as a native view?

Probably a webview since it's usually possible to include a few selected raw HTML tags.

  1. Do we want to handle markdown flavors?

GitHub flavored Markdown would be nice.

I think many of these questions are related to the first question. The way this is done in TextMate is via a bundle (extension). TextMate has a generic output window. The bundle chooses the type of output, plain text or HTML. For HTML TextMate will open a output window with a webview. For plain text it will just render the text in the output window. Since the output window is not tied to the Markdown feature, but a generic feature of TextMate, it's possible to configure if it should open a new window or open a new pane within the existing window. It's also possible to configure the placement of the pane. The Markdown bundle that ships with TextMate is for regular Markdown. But, since it's just a bundle, there are other bundles available that support various Markdown flavors.

If the feature is not implemented as an extension and instead built-in, and the output pane/window/tab is specific for the Markdown feature, then it might not be worth support various settings on how/when/where the output should appear. But if it's a generic output view that can be reused for other things, then I definitely think the placement of the view should be configurable.

In TextMate the output window is used for other bundles as well, like the HTML bundle. It has a Preview command, just as the Markdown bundle. Same name of the command/menu item, same keyboard shortcut, they all follow the same convention. See my comment here #262 (comment) which is a bit related.

@TheGlorySaint
Copy link

I Love Codeedit, have you guys thought about when this enhancement will be added?

@rcarmo
Copy link

rcarmo commented Sep 5, 2024

Curious to know if anything is happening regarding this since Markdown is a critical part of the documentation workflow for me.

@thecoolwinter
Copy link
Collaborator

Curious to know if anything is happening regarding this since Markdown is a critical part of the documentation workflow for me.

I don't think anyone is actively working on this right now, but it's 100% a planned feature. We're allocating more time towards things like LSP support and continued improvements to source control right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Todo
Development

No branches or pull requests

9 participants