yamh 0.2.0  yamh: ^0.2.0 copied to clipboard
yamh: ^0.2.0 copied to clipboard
Yet Another Markdown to HTML converter. Dirt simple and null-safe.
Yet Another Markdown to HTML converter #
A dirt simple, null-safe Markdown to HTML converter.
Features #
- Functions for both Dart and Flutter*
- Support for either string input or file input
- Batch parse Markdown files*
- Available for NPM**
- Powers a WTFF***
- Written in Dart (because I felt like it)
* Planned features; not complete or in the latest build yet.
** This would actually be really nice to make things compile way faster with several files. Planned, but not guaranteed.
*** This is just an idea of mine that I may or may not do. Stands for
Way Too Fast Frameworkand would be used for websites.
Usage #
You can either build YAMH or download a pre-built binary from GitHub.
Command-line usage #
You can see the usage information provided by running ./yamh -h or ./yamh --help. All of these commands are flags/options for the ./yamh command and should be appended to it.
- -f, --file <file>— Parse a Markdown file to HTML, where- <file>is the path to a Markdown file.
- -s, --string <string>— Parse a string containing Markdown to HTML, where- <string>is the aforementioned string.
- -o, --out <out-dir>— Specify a place for converted HTML files to go.- If you are using the -soption, it will default to saving in the console.
- If you are using the -foption, it will default to saving in the same directory as the Markdown file.
 
- If you are using the 
in Dart and Flutter #
Note: Support for Flutter has not been added yet. When it is, this will be updated to show the relevant documentation.
There are two core functions you can use:
- yamh_str(<string>, [output])— Converts a string of Markdown to HTML. You can omit the- [output]with- null, and have it be returned for using in a promise (see the example in- example/example.dart).
- yamh_file(<file>, [output])— Converts a Markdown file to a HTML file. You can omit the- [output]with- null, and have the file be saved to the same directory as the Markdown file. Otherwise, you can specify where you want the file to be saved.
You can see a working example in both example/example.dart, as well as test/test.dart. You can read the full API reference here or generate it locally using dartdoc.
in Node/NPM #
This has not been implemented yet. When it is, this will be updated to show the relevant documentation. It may also never happen, due to a lack of knowledge.
Building #
- Install Dart
- Fetch dependencies (dart pub get)
Building for the command-line #
To build binaries, use dart2native bin/yamh.dart -o build/yamh.ext; replacing « ext » with « exe » if on Windows or « app » if on macOS.
Building for JavaScript/Web #
To build, use dart2js bin/yamh.dart -o build/yamh.js -m -O2. You can replace « build/yamh.js » for wherever you want the JavaScript file to be saved to.
Acknowledgements #
This project is licensed under the MIT License. You can see a copy of it in the LICENSE file in the root of this repository.
Special thanks to:
- the Dart and Flutter teams for having great documenation of the language,
- emn178 for making a Markdown example that is used in test and examples; and:
- all of the dependencies of YAMH for helping power this tool.
This was made to try and cross off the « Markdown to HTML converter » here. Although it does function for other things, you can have a single binary to interact with for all your needs.