nea / MarkdownViewerPlusPlus

A Notepad++ Plugin to view a Markdown file rendered on-the-fly
MIT License
1.17k stars 143 forks source link

problems displaying lists #39

Closed fmigneault closed 6 years ago

fmigneault commented 7 years ago

Using bullet lists sometimes causes issues as displayed in the following image:

(1) Bullets are 1 line above the corresponding paragraph text (ie: some '\n' added before the text?)
(2) Random numbers appear in before indented paragraphs or indented paragraphs with bullet list.

image

nea commented 7 years ago

Hey @KenjiKyo

Yeah, some colleagues of mine have face a similar issue sometimes but there wasn't a real reproducible test case so far. But I have to look into this.

Regarding the numbers: It seems it interprets the first name abbreviations such as "F." as a new numbered list. Don't know why ^^ Will check. Line breaks in a list with indented second lines in general is something making problems sometimes.

Thanks

p11h commented 7 years ago

Regarding paragraphs in lists; these are Loose lists, which according to the CommonMark Spec:

A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.)

One option for handling this is using CSS to remove the margins from the paragraphs within list items, for example:

li p {
  margin-top: 0;
  margin-bottom: 0;
}
nea commented 6 years ago

Hey @fmigneault

Sorry for the long delay but I just released 0.8.0.

Could you please try to reproduce with the newest version?

Thanks a lot

fmigneault commented 6 years ago

I have version 0.8.0.4052 installed. I still have the same output as in the initial image.

nea commented 6 years ago

Hey @fmigneault

It is exactly as @stezmi stated. The result are loose lists with paragraphs because of the space between the list items. His CSS fix would be one to quickly apply for now.

As the HTML Renderer is not actively developed anymore I will take a look on how to tackle it.

Best

fmigneault commented 6 years ago

I have tried the CSS proposition by @stezmi It correctly fixes the issue of the paragraph space for block list items.

The 2nd issue of my first post (random numbers) is still present though.

nea commented 6 years ago

Hey @fmigneault

The "numbering" issue is actually interpreting F.

A., B., C. etc. would be a numbered list, therefore F. equals 6, as the row starts with it and it is not in the middle of a sentence.

You can escape the dot signaling a list i.e. F\. Comachi.

Best

crystalfp commented 6 years ago

0.8.0 + the CSS two liner, solved the problem for loose and tight lists.

Just a suggestion. In the "Options" dialog seems the CSS fragment is applied only to HTML export, not to the rendering inside Npp. Maybe just adding after "Custom CSS" the following "(used for internal rendering and HTML export)" could help.

nea commented 6 years ago

Hey @crystalfp

Thanks for the hint.

Best

fmigneault commented 6 years ago

@nea wow well spotted about the numbering letter interpretation. I didn't think about that. Indeed resolved with escaping the characters. Thanks!

nea commented 6 years ago

Glad to hear @fmigneault :)