This article guides on how to merge MD files in Java. It shares details to set the IDE, a list of steps, and a sample code to merge Markdown files in Java. You may repeat the process as many times as there are MD files to be merged.
Steps to Combine MD in Java
- Set the environment to use Aspose.Words for Java to merge MD files
- Import the desired classes from the package
- Apply the license to avail complete product features
- Create the LoadOptions object for each MD file, optionally, and set the warning callback
- Load all the MD files separately into a Document object and assign the respective LoadOptions
- Access the destination MD file Document object for appending other MD files into it using the appendDocument() object
- Pass the input MD file and ImportFormatMode while invoking the appendDocument() method for each merging of the MD file
The above steps describe how to merge Markdown in Java. Import the classes from the loaded package, create the MarkdownLoadOptions with reference to the warning callback and create an individual Document object for the destination and each input MD file by utilizing the relevant MarkdownLoadOptions object. Select the destination MD file object and call the appendDocument() object for each of the MD files that you want to merge into the destination MD file.
Code to Merge MD in Java
This code demonstrates the process to merge MD files. The MarkdownLoadOptions supports preserving the empty lines, handling underline formatting, and setting warning callbacks while loading the MD file into the Document object. The ImportFormatMode can be used to define the merging format, such as using the destination formatting, source formatting, or using both the formatting while appending the MD file.
This article describes the process to combine multiple MD files. To convert a Markdown file to a Word file, refer to the article Convert Markdown to Word in Java.