Penmanship

A Gradle plugin that makes it easy to convert Markdown files to Android XML.

Лицензия

Лицензия

Группа

Группа

com.mindsnacks
Идентификатор

Идентификатор

penmanship
Последняя версия

Последняя версия

0.9
Дата

Дата

Тип

Тип

jar
Описание

Описание

Penmanship
A Gradle plugin that makes it easy to convert Markdown files to Android XML.
Ссылка на сайт

Ссылка на сайт

http://github.com/mindsnacks/penmanship
Организация-разработчик

Организация-разработчик

MindSnacks Inc.
Система контроля версий

Система контроля версий

http://github.com/mindsnacks/penmanship

Скачать penmanship

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.mindsnacks/penmanship/ -->
<dependency>
    <groupId>com.mindsnacks</groupId>
    <artifactId>penmanship</artifactId>
    <version>0.9</version>
</dependency>
// https://jarcasting.com/artifacts/com.mindsnacks/penmanship/
implementation 'com.mindsnacks:penmanship:0.9'
// https://jarcasting.com/artifacts/com.mindsnacks/penmanship/
implementation ("com.mindsnacks:penmanship:0.9")
'com.mindsnacks:penmanship:jar:0.9'
<dependency org="com.mindsnacks" name="penmanship" rev="0.9">
  <artifact name="penmanship" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.mindsnacks', module='penmanship', version='0.9')
)
libraryDependencies += "com.mindsnacks" % "penmanship" % "0.9"
[com.mindsnacks/penmanship "0.9"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.pegdown : pegdown jar 1.4.1
com.google.guava : guava jar 15.0
commons-io : commons-io jar 2.4

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

Penmanship

A simple Gradle plug-in that makes it easy to convert Markdown documents into native Android layout XML files.

Useful for apps that require rich content and an easy way to maintain.

Screenshot 1 Screenshot 2

Build Process Integration

Add Penmanship to your buildscript depdencies and apply the plug-in:

buildscript {
  repositories {
    mavenCentral()
  }
  
  dependencies {
    classpath 'com.android.tools.build:gradle:0.7+'
    classpath 'com.mindsnacks:penmanship:CURRENT-VERSION'
  }
}

apply plugin: 'penmanship'

Then create a task to convert your Markdown files:

import com.mindsnacks.penmanship.gradle.ConvertMarkdownDirectoryToAndroidResourcesDirectoryTask
import com.android.build.gradle.tasks.ProcessAndroidResources

task generateMarkdownResources(type: ConvertMarkdownDirectoryToAndroidResourcesDirectoryTask) {
  def inputTree = file('path/to/directory/containing_only_your_markdown/and_images')
  inputs.dir inputTree
  outputs.dir file("penmanship_gen/res")
}

tasks.withType(ProcessAndroidResources) { processResourcesTask ->
  processResourcesTask.dependsOn generateMarkdownResources
}

Finally, just add your generated XML directory to your source set:

android {
  sourceSets {
    main {
      res.srcDir 'penmanship_gen/res'
    }
  }
}

App Integration

Loading Layouts

Since there is not one super common way of using the generated XML, it's up to you to inflate the layouts and integrate them into your app. Markdroid provides a very small helper library to make this easy, just add it as an app dependency:

compile 'com.mindsnacks:penmanship-helper:CURRENT-VERSION@aar'

This library provides a few methods for easily loading layout files and enabling rich text. To see an example, check out MainActivity.java in the example project.

Styling Layouts

Each Markdown element gets its own layout in the generated layout XML files. It's up to you to implement these styles. For an example implementation, refer to the example project's styles file.

Markdown Support

Markdown support is still somewhat limited. The following features work:

  1. Text formatting (bold and italics)
  2. Headings
  3. Blockquotes
  4. Unordered and ordered lists
  5. Images (only local images, can't be inline with text)
  6. Links
com.mindsnacks

Elevate

Версии библиотеки

Версия
0.9