Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Expanding HtmlConvert.cs to handle List Items

$
0
0
This works however all the lists are numerical. If you can figure out how to have the style change (decimal then alpha then roman...) for sub-ordered lists let me know.

Add the following to: internal static void ConvertTo(HtmlNode node, TextWriter outText, PreceedingDomTextInfo textInfo)
case "li":
                                if (textInfo.ListIndex > 0)
                                {
                                    outText.Write("\r\n\t{0}.", textInfo.ListIndex++);
                                }
                                else
                                {
                                    outText.Write("\r\n\t•"); //using '*' as bullet char, with tab after, but whatever you want eg "\t->", if utf-8 0x2022
                                }
                                isInline = false;
                                break;
                            case "ol":
                                listIndex = 1;
                                goto case "ul";
                            case "ul": //not handling nested lists any differently at this stage - that is getting close to rendering problems
                                endElementString = "\r\n";
                                isInline = false;
                                break;

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>