Coder Social home page Coder Social logo

Comments (10)

Knagis avatar Knagis commented on August 16, 2024 3

0.15.0 has been released with the fix.

from commonmark.net.

Knagis avatar Knagis commented on August 16, 2024 1

Thank you, it indeed reproduces the issue; it seems that the tab conversion is incorrect since using four spaces instead of tabs work as expected.

I will let you know as soon as it is fixed.

from commonmark.net.

Knagis avatar Knagis commented on August 16, 2024 1

Sorry about the very slow response rate...

The 0.15.0 release was again improperly compiled and thus was actually an older version of the binaries. 0.15.1 that I just pushed to nuget should fix it.

from commonmark.net.

Toine-db avatar Toine-db commented on August 16, 2024 1

I tested it on my implementation and it seems to work for 2 levels nested listings.

So good job, thanks!

from commonmark.net.

tiesont avatar tiesont commented on August 16, 2024

What is the Markdown text you're passing to the converter? If I run the following test, I get the correct output:

using System;
//
using NUnit.Framework;
//
using CommonMark;

namespace CommonMarkTests
{
    [TestFixture]
    public class MarkdownListTests
    {
        [Test]
        public void NestedListsShouldProduceValidHTML_Test()
        {
            // arrange
            string original = string.Join(Environment.NewLine, "- item1" , "- item2", "    - item2-1" , "    - item2-2", "    - item2-3");
            string expected = "<ul>{0}<li>item1</li>{0}<li>item2{0}<ul>{0}<li>item2-1</li>{0}<li>item2-2</li>{0}<li>item2-3</li>{0}</ul>{0}</li>{0}</ul>{0}{0}".Replace("{0}", Environment.NewLine);
            string actual = string.Empty;

            // act
            actual = CommonMarkConverter.Convert(original);

            // assert
            Assert.AreEqual(expected, actual);
        }
    }
}

This is an NUnit 3 test, with the extra line return mentioned in #105 (which means this will fail when the next release is made).

from commonmark.net.

Toine-db avatar Toine-db commented on August 16, 2024

The list is exactly something I want to convert, its a Unit test in my library.

I do not use .Convert to HTML, I only use the Parsing to c# object with .Parse.
https://github.com/Toine-db/Xamarin.MarkdownParser/blob/master/Sources/Xamarin.MarkdownParser.Core/MarkdownParser.cs#L27

I really get a list in list in list
https://1drv.ms/i/s!AqZ7dJLKaN9Tj-5zE9IqzqbPvFklXw
(an enumeration from item2, skipping item 1)

At this point in code I only read a md file and used it for CommonMarkConverter.Parse()

PS: Im working on 0.14 and using https://github.com/Knagis/CommonMark.NET/blob/master/CommonMark/CommonMarkConverter.cs#L252

from commonmark.net.

Knagis avatar Knagis commented on August 16, 2024

Could you please upload the exact file you are parsing and getting this result? Perhaps there are some tab characters hidden there.

I tried it with the console app and it works correctly:

>type test.txt
* item1
* item2
  * item2-1
  * item2-2
  * item2-3
>CommonMark.Console.exe --ast test.txt
document
  list(type=bullet tight=True bullet_char=*)
    list_item
      paragraph
        str "item1"
    list_item
      paragraph
        str "item2"
      list(type=bullet tight=True bullet_char=*)
        list_item
          paragraph
            str "item2-1"
        list_item
          paragraph
            str "item2-2"
        list_item
          paragraph
            str "item2-3"

from commonmark.net.

Toine-db avatar Toine-db commented on August 16, 2024

Thanks for helping guys.

The file is in my rep; https://github.com/Toine-db/Xamarin.MarkdownParser/blob/master/Sources/Xamarin.MarkdownParser.Test/examples/sections/nestedlist.md

from commonmark.net.

Toine-db avatar Toine-db commented on August 16, 2024

Just checked, and the same issue still occurs on: (with indent by tabs)

  • item1
  • item2
    • item2-1
    • item2-2
    • item2-3

from commonmark.net.

Toine-db avatar Toine-db commented on August 16, 2024

@Knagis no problem, I also don't have a lot of time...... it's great you have taken a look.

Thanks, ill test it in a few days (hopefully)

from commonmark.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.