In some cases it’s required to specify the document format manually to guarantee correct output produced by GroupDocs.Parser. The following are the cases when the document format must be specified manually:
The following example shows how to specify the document format for Markup document:
try(InputStreamstream=newFileInputStream(Constants.SampleMd)){// Create an instance of Parser class for markdown document
try(Parserparser=newParser(stream,newLoadOptions(FileFormat.Markup))){// Check if text extraction is supported
if(!parser.getFeatures().isText()){System.out.println("Text extraction isn't supported.");return;}try(TextReaderreader=parser.getText()){// Print the document text
// Markdown is detected; text without special symbols is printed
System.out.println(reader.readToEnd());}}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: