MDPR (Multi-line Comments/Notes Markdown Parser)
- CLI CLI
- Stack
- GITHUB https://github.com/xynapz/mdpr
mdpr - Multi-line Markdown Parser (v1.0)
mdpr is a command-line tool written in C that parses multi-line code blocks within a markdown file and extracts only the relevant code content. This is particularly useful for extracting code snippets from large markdown files containing documentation or tutorials.
Features
- Parses multi-line code blocks delimited by opening (
/*) and closing (*/) comments. - Ignores leading and trailing whitespace within the block.
- Trims leading and trailing spaces from each line of code within the block.
- Outputs the extracted code content to a specified output file.
Usage
mdpr takes four arguments:
-f: Path to the input markdown file containing the code blocks.-o: Path to the output file where the extracted code will be written.
Example:
./mdpr -f test_file.c -o test_file.md
This command will parse the test_file.c file for multi-line code blocks and write the extracted code to test_file.md.
Building
mdpr requires a C compiler and standard libraries to build. Run the following command in your terminal:
gcc -o mdpr main.c
This will create an executable named mdpr in your current directory.
Limitations
- This current version only supports code blocks delimited by comment characters (
/*and*/). - Nested code blocks are not supported.
Future Development
- Implement support for more common code block delimiters (e.g., triple backticks).
- Allow configuration of code block delimiters.
- Explore more advanced parsing options for different programming languages.
Contributing
We welcome contributions to the mdpr project! If you have any suggestions, bug fixes, or feature enhancements, feel free to fork the repository and submit a pull request.
License
mdpr is distributed under the MIT License. See the LICENSE file for details.