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

Better code preview: Different background and improve multi-line code support #99

Open
Ativerc opened this issue Jan 17, 2017 · 3 comments

Comments

@Ativerc
Copy link

Ativerc commented Jan 17, 2017

selection_011

Here are the current problems with code in Markdown Preview in Brackets:

  1. The background of code doesn't change. Just the font changes. This makes it harder to skim for code snippets.

  2. Multi-line code preview is erratic. (Please look at the screenshot attached. The same <p> has different preview output.) The ``` doesn't disappear.

  3. Sometimes the whitespace isn't preserved in multi-line code snippet.

Can the people who are developing this just conform to one Markdown standard so that I don't have to change my writing style just so the preview looks nice? Some people have advised me to remember the markdown format and not to depend on the preview. But I need the preview/final-render of markdown, while i look over my notes sometimes.

P.S.: CommonMark.

@Ativerc
Copy link
Author

Ativerc commented Jan 17, 2017

selection_013

In this screenshot, you see that the code snippets are different but they are presented without any indication of that.

@khatastroffik
Copy link

The Markdown Preview plugin is based on the marked project.
The plugin allow to choose between "Standard Markdown" and "Github-Flavored (GFM)".

The "Standard Markdown" doesn't define/implement the fenced code blocks, though the "Github-Flavored (GFM)" does.

In your code sample:

```
   <p>Hi</p>
```
```
<p>Hi</p>
```

is interpreted differently:

  • Standard:
    • all fences are ignored
    • the first block is indented and will be formated as <code>
    • the second block isn't idented and will be interpreted as HTML markup and rendered!
  • GFM:
    • the fences are recognized
    • the content between the fences is interpreted as code block (independent from the indentation of the block content)

Hence: the behavior of the plugin is correct, afaics.


Note:
there's a new version of the "marked" library available.

@khatastroffik
Copy link

@Ativerc:
as for your issue No 2: the color of the code background within the preview panel depends on the theme chosen. Hence, some themes enforce a background color for the <pre><code>... elements and some other themes don't.
workaround in your case: edit and adapt the theme file of your choice...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants