From aab58ea47aa7760b39930e316880a9e01bc0baf1 Mon Sep 17 00:00:00 2001 From: monosoul Date: Wed, 10 Apr 2019 15:38:37 +0500 Subject: [PATCH] add usage example to readme --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index efc5d91..6702f8c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,41 @@ # Markdown to HTML Page Generator Gradle Plugin This Gradle plugin's goal is to provide a way of using [the maven markdown-page-generator-plugin by walokra](https://github.com/walokra/markdown-page-generator-plugin). + +Usage example (Kotlin DSL): +```kotlin +buildscript { + dependencies { + classpath("com.github.monosoul:markdown-page-generator-gradle-plugin:2.1.0") + } + + repositories { + jcenter() + } +} + +apply(plugin = "com.github.monosoul.markdown.page.generator") + +tasks { + + val generateHtml = getByName("generateHtml", GenerateHtmlTask::class) { + dependsOn(processResources) + + val encoding = "UTF-8" + + recursiveInput = true + pegdownExtensions = "TABLES,FENCED_CODE_BLOCKS" + inputEncoding = encoding + outputEncoding = encoding + + val sourceDir = File(buildDir, "resources/main/markdown") + val outputDir by extra { File(buildDir, "html") } + + inputDirectory = sourceDir + outputDirectory = outputDir + headerHtmlFile = File(sourceDir, "header.html") + footerHtmlFile = File(sourceDir, "footer.html") + transformRelativeMarkdownLinks = true + } +} +``` \ No newline at end of file