Created
September 14, 2016 17:33
-
-
Save lavcraft/6d733cb8d410522972b85c3d3b094968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { jcenter() } | |
dependencies { classpath 'org.pegdown:pegdown:1.5.0' } | |
} | |
import org.pegdown.PegDownProcessor | |
task md { | |
def mp = new PegDownProcessor(org.pegdown.Extensions.ALL) | |
ext.outputDir = new File(buildDir, 'readme_html') | |
ext.outputFile = new File(outputDir, 'readme.html') | |
inputs.file file("README.md") | |
outputs.dir outputDir | |
outputs.dir outputFile | |
doLast { | |
def html = mp.markdownToHtml(file('README.md').text) | |
outputDir.mkdirs() | |
outputFile << """ | |
<html> | |
<head><meta charset=\"utf-8\"></head> | |
$html | |
</html> | |
""" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment