russcam / asciidocnet

AsciiDoc Processor for .NET
Apache License 2.0
39 stars 9 forks source link

Help use library #13

Open ltuttini opened 4 years ago

ltuttini commented 4 years ago

I am creating a Azure Function and need generate html from string with asciidoc

I studied the library code and test, but I couldn't find how use the classes

I can see Document.Parse() and AsciiDocVisitor, what is the real class to process the asciidoc ? Can you write any example code? My input is a string with the asciidoc and need other string with the html

thanks

sebastianslutzky commented 3 years ago

I am creating a Azure Function and need generate html from string with asciidoc

I studied the library code and test, but I couldn't find how use the classes

I can see Document.Parse() and AsciiDocVisitor, what is the real class to process the asciidoc ? Can you write any example code? My input is a string with the asciidoc and need other string with the html

thanks

Have you ever figured this out? I am trying to convert to html, I see the HtmlVisitor and HtmlSectionVisitor... I wonder if there is a single static function that puts it all together

russcam commented 3 years ago

Generating HTML hasn't been implemented. The library is super alpha, rough and really not ready for production use. It was written to fill a need of patching existing asciidoc files in C#, with an intention to develop it further, however it hasn't had any time invested into it.

MikDal002 commented 2 years ago

AsciiDoc visitor is a class which is able to write document in AsciiDoc based on object tree. The simplest document is to write somethinh like that:

var asciiDocDocument = new Document();
asciiDocDocument.Attributes.Add(new AttributeEntry("toc", "true"));
asciiDocDocument.Authors.Add(new AuthorInfo() { FirstName = "Name", LastName = "Last Name" });
asciiDocDocument.DocType = DocType.Article;
asciiDocDocument.Title = new DocumentTitle("Test title");

asciiDocDocument.Add(new SectionTitle("Chapter text", 1));

using var asciiDocVisitor = new AsciiDocVisitor("index.adoc");
asciiDocVisitor.VisitDocument(asciiDocDocument);

This will give you a file like this:

:toc: true

= Test title

Name Last Name

= Chapter title