jmalarcon / MIIS

Powerful file-based CMS for IIS - Your Markdown-based documentation or website in a few minutes!
https://miis.azurewebsites.net/
MIT License
31 stars 6 forks source link

Inline HTML tag <p> ignored within lists #27

Closed ritti closed 5 years ago

ritti commented 5 years ago

I have some generated Markdown files that contain inline HTML (paragraph) tag. When the <p> tag is part of a list it is ignored. Consequently the output looks not very nice and is in many cases not readable.

MD source:

<p>First Paragraph</p><p>Second Paragraph</p>

- Item 1  
  <p>First Paragraph in List Item 1</p>
  <p>Second Paragraph in List Item 1</p>
- Item 2 <p>First Paragraph in List Item 2</p> <p>Second  Paragraph in List Item 2</p>

The output on MIIS looks as follows: MIIS_Paragraph_in_List

Expected Result start:

First Paragraph

Second Paragraph

Expected Result end:

Hint: Preview was tested for commonmark/markdig on https://babelmark.github.io

jmalarcon commented 5 years ago

Hi:

I'm not sure about how you have tried this, but it works as expected. If I use the exact code you have pasted above and I render a page with MIIS i get the expected result and HTML:

<p>First Paragraph</p><p>Second Paragraph</p>
<ul>
<li>Item 1<p>First Paragraph in List Item 1</p>
<p>Second Paragraph in List Item 1</p>
</li>
<li>Item 2 <p>First Paragraph in List Item 2</p> <p>Second  Paragraph in List Item 2</p></li>
</ul>

and it's rendered this way:

image

So everything works as expected.

I'm attached the sample file I've used, pasted from your message.

Please, attach a ZIP with a sample of the issue (everythinh included: template used, bin folder...) so that I can see exactly what's happening.

Cheers.

test.zip

ritti commented 5 years ago

Hi, first of all thanks for the quick response. I tested with Chrome, Mozilla and IE - all show also your test.md file as described in my issue. When I open the html source from the rendered md file, it looks nearly the same like yours:

      <article class="article">
        <div class="wrapper miis-content">
          <p>First Paragraph</p><p>Second Paragraph</p>
<ul>
<li>Item 1<p>First Paragraph in List Item 1</p>
<p>Second Paragraph in List Item 1</p>
</li>
<li>Item 2 <p>First Paragraph in List Item 2</p> <p>Second  Paragraph in List Item 2</p></li>
</ul>

          <aside class="copyright" role="note">
            <hr/>
              © Jose M. Alarcon - 2017 - Powered by MIIS
          </aside>

Attached is the zip file that contains the original miis package and additional 2 md files on top level (paragraph.md and test.md). I deployed the content on IIS Version 10.0.15063.0 on Windows 10. Any idea? Thanks!!

MIIS-Release.zip

jmalarcon commented 5 years ago

Hi again:

This is working as expected. The problem is not with the resulting HTML, is that this specific template you're using has a style to force certain paragraphs as inline elements, as you can see here:

miis-p-inline-style

Normally a paragraph inside a list element doesn't make a lot of sense, so in this specific template's CSS makes them inline elements.

On the other hand, Why would you use this kind of simple HTML inside markdown? I mean, if you need a paragraph just create a new line in the markdown. Usually is not a good idea mixing HTML and Markdown in the same file.

Please, take into account that MIIS allows the use of the .mdh extension for plain HTML contents that you want to use with templates. The only difference is that they are not translated from Markdown. This gives a lot of flexibility for very complex pages that are better made with plain HTML.

HTH.

ritti commented 5 years ago

Hi, thanks for the worthful hint. Now I understand the problem. The markdown with the inline html is generated, that's the reason why. But I will see if we can change this. Otherwise I can align the css. Thanks a lot!

I also thought about to open another issue - but maybe the solution goes in the same direction and it is only a configuration issue.

Problem Some special characters appear different on MIIS.

Source MD File

Source MD File begin --------------------------------------

Behaviour of Special Characters in Markdown

Smiley

The characters :* in plain text get converted to a smiley.

Bold : Some text

Codeblock with $“

   $"

$"

Usage of $ and ' as following characters

After the occurrence of the 2 characters $'

the additional text that will appear at the bottom of the page outside of the main template.

------------------Source MD File end --------------------------------------

It is also attached as zip. The configuration for testing is the default MIIS package as already used for this issue.

TestSpecialCharacters.zip

Result on MIIS

Behaviour of Special Characters in Markdown on MIIS

Expected Result https://babelmark.github.io

If it is worth to open an own issue please let me know.

Thanks a lot for your support!!

jmalarcon commented 5 years ago

Hi again:

The smiley thing is the default option. If you read the docs there's a configuration parameter called UseEmoji that is enabled by default and that makes this kind of conversions. You can disable it by setting it to 0 globally in your web.config with MIIS:UseEmoji or individually in specific files using the Front Matter.

The $ sign issue it's not MIIS, it's Markdig. MIIS doesn't make any replacements like this in the code as you can see if you simply run the source code step by step with your sample file. I recommend you to open an issue in Markdig to anything related with markdown to HTML conversions. MIIS uses Markdig for those.

To make sure that you issue is with the conversion process, not with the rendering process, I recommend you to test the content without any template in MIIS to make sure that the issue is not CSS related, as your first one was. If you don't set any template for MIIS (by default you have the Material one selected, just delete the MIIS:TemplateName key in web.config) what you'll get is the raw generated final HTML, and you can check easily the final HTML and the raw aspect of it to see if something is different as expected.

HTH

ritti commented 5 years ago

Hi again,

changing the UseEmoji setting then it works. To be honest I tried it before but set the value to "1" instead of "0". The documunentation is a little bit confusing. It is described how to turn this feature off and the there is a example where the value is "1".

Regarding the other two issues I followed your tip and removed the template setting. The issues are still there. As you can see in the screenshots for the $' issue a new parapraph is opened and the $' is not rendered in the html at all.

When I had a look on babelmark the Markdig implementation renders it correctly. Sure that the issue does not exist in the MIIS logic?

AdditionalTextAppearsAtTheBottom babelmark3 _ Compare Markdown Implementations

Thank you very much!

jmalarcon commented 5 years ago

Hi again:

You were right about the bug. I overlooked it because AFAIK there were no substitutions for $ in the code. And that was the problem. In fact there should be one in the TemplateHelper class to prevent replacement expressions to act inadvertently in the content when replacing placeholders.

I've opened a new issue for this. Now its fixed, although I've not released a new version yet since I want to add some more features in the coming days and will release a new version soon that includes this. If you need it now you can just compile the latest version of the code by yourself (open it in VS and Build).

Thanks for pointing it out and sorry for having missed it in the first place.

ritti commented 5 years ago

Thanks for the quick fix! Can you make a rough estimate when the new version will be available? Purely out of curiosity - what feature are planned - adding a search? :-)

Thanks a lot!

jmalarcon commented 5 years ago

IDK, it depends on the free time I have. My expectations are to devote time in the next couple of weeks, but if you want make god laugh, just start planning :-D

In my immediate roadmap are some new automatic fields, conditional regions in templates and (hopefully) being able to extend the tool externally (plugins). Search is not on my roadmap because, not being MIIS a static site generator but a semi-dynamic one, it's difficult to index everything in large sites without performance implications. IT should be a dedicated tool, independent of MIIS I guess. In this issue I've posted several readily alternatives to add search to your sites.

Cheers.

jmalarcon commented 5 years ago

@ritti

Since I'm seeing that the next release is going to take longer than I expected, I've released a minor version 2.2.1 with this fix included. You can download it here.

HTH

ritti commented 5 years ago

Thanks a lot! But releasing a version 2.3.0 one day later isn't too long :-)

jmalarcon commented 5 years ago

Yes, well, versions are always unexpected because I never know when I'll have the time. In this case the 2.3.0 version was a very minor one. What I was referring to was the 3.0.0 version which will have full Liquid syntax and I will need to destroy and build up again the HTML rendering part.