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) mode lists problem #676

Closed
djordjeandrejevic opened this issue Nov 29, 2017 · 7 comments · Fixed by #1822 or #1823
Closed

Markdown (preview) mode lists problem #676

djordjeandrejevic opened this issue Nov 29, 2017 · 7 comments · Fixed by #1822 or #1823
Assignees
Labels
bug Something isn't working
Milestone

Comments

@djordjeandrejevic
Copy link

djordjeandrejevic commented Nov 29, 2017

Hi,

I've faced strange behavior while creating a lists in Simplenote 1.1.0. Wasn't sure if that's expected behavior for the markdown, but I tested it later in online markdown tools and they didn't act the same as Simplenote.

Steps to reproduce

  1. Create a new note and paste the following text (make sure to have markdown for that note enabled):
# Test

- test 1
- test 2
- test 3
- 
  1. Switch from Edit to Preview mode.

What I expected

I expected consistently styled list without the bold parts.

What happened instead

Last list item turned into bold (maybe even heading?) and the last - character disappeared.

screenshot_289

OS version

Ubuntu 16.10

@dmsnell dmsnell added the bug Something isn't working label Nov 29, 2017
@dokker
Copy link

dokker commented Feb 16, 2018

Hi,
Maybe this is connected to this issue:

Markdown:

# test

- __List item:__ This is some text with __strong__ in it

Result:
screenshot_2018-02-16_13-27-07

Archlinux
Simplenote version 1.1.3

@tuckerrc
Copy link

tuckerrc commented Apr 5, 2018

I believe it was rendered as a heading. The single - is causing it to be rendered as a Heading 2.

## Heading 2

or

Heading 2
-------------

Both render as

Heading 2

A possible fix would be to catch a single - or * and render a blank bulleted line instead of the heading

@pauljacobson
Copy link

There is a related issue with how Markdown lists are rendered in the Electron app. Lists that don't include a line space between the text immediately before the bullet points, and the bullet points themselves, are still rendered as formatted lists.

For example, this list shouldn't render correctly because there is no line space before the bullet points:

Instead, it does:

@djordjeandrejevic
Copy link
Author

djordjeandrejevic commented Jul 26, 2018

One more issue regarding markdown numbered lists.

Paste the following and switch to markdown preview:

# Test

1. One
2. Two
3. Three

some_text some_text

4. Four

Preview mode doesn't continue numbering. Instead it starts from beginning:

screenshot_480

Ubuntu 16.10 / Simplenote 1.1.6

@mfcarneiro
Copy link

I'm using on Manjaro here.

The list note are still showing the markdown, not updating when the preview is off:

Manjaro 17.1.12 / Simplenote 1.1.7

@robertpba
Copy link

The numbering issue reported by djordjeandrejevic affects me too and has caused me to use bullets instead of numbers to avoid this.

It happens without fail when I have some preformatted text within the list like this:

1. A point
2. Another point
```
Some code
Some more code
```
3. A third point

Try it in Simplenote 1.1.7 on Ubuntu 18.04 and the last item renders with a number 1.

@MrModest
Copy link

screenshot_simplenote_20181017-175657
screenshot_simplenote_20181017-175706
Checkbox list showing incorrectly
Android 8.1
In Kde Neon works

@belcherj belcherj self-assigned this Jan 8, 2020
belcherj added a commit that referenced this issue Jan 8, 2020
Fixes: #676

The numbering of ol lists is currently broken when you have a list that is
interrupted with a line of text that is not part of the list.

This PR whitelists the start attribute on ol tags which fixes the issue.

For example:

1. One
1. Two
1. Three
some_text some_text
1. Four
The above example should number the list 1 to 4. It, however, orders the list 1
to 3 and then after the interrupt starts over at 1.

The output from showdown, the markdown to html processor, is:

<ol>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
<p>some_text some_text</p>
<ol start="4">
<li>Four</li>
</ol>
Notice the second ol has a start attribute <ol start="4">.

When we pass the html into the sanitizeHtml function that attribute is
stripped. This PR whitelists that attribute so it is not stripped.
belcherj added a commit that referenced this issue Jan 8, 2020
Fixes: #676

When a list has a trailing `-` the markdown renderer (showdown) will make the
previous list element an h2. Technically this is valid markdown and is doing
what it should but this is usually not the intention of the user. Because we
auto-add  a `-` after a carriage return users run into this issue regularly.

This issue is resolved by enabling the `smoothLivePreview` option in showdown.

You can replicate this with the following markdown:

```
- test 1
- test 2
- test 3
-
```
Currently, this will output:

```
<ul>
<li>test 1</li>
<li>test 2</li>
</ul>
<h2 id="test3">- test 3</h2>
```
After the addition of the `smoothLivePreview` option it will return:
```
<ul>
<li>test 1</li>
<li>test 2</li>
<li>test 3</li>
-
</ul>
```
@codebykat codebykat added this to the 1.14 milestone Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
10 participants