html-to-markdown


Лицензия

Лицензия

MIT
Группа

Группа

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

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

html-to-markdown
Последняя версия

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

0.8.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

html-to-markdown
html-to-markdown
Ссылка на сайт

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

https://github.com/tkqubo/scala-html-to-markdown
Организация-разработчик

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

com.github.tkqubo
Система контроля версий

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

https://github.com/tkqubo/scala-html-to-markdown

Скачать html-to-markdown

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

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-library jar 2.12.8
org.jsoup : jsoup jar 1.12.1

test (4)

Идентификатор библиотеки Тип Версия
org.specs2 : specs2-core_2.12 jar 4.6.0
org.specs2 : specs2-matcher_2.12 jar 4.6.0
org.specs2 : specs2-matcher-extra_2.12 jar 4.6.0
org.specs2 : specs2-mock_2.12 jar 4.6.0

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

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

Scala HTML-to-Markdown

Maven Central License: MIT Circle CI Coverage Status

An HTML to Markdown converter written in Scala, inspired by https://github.com/domchristie/to-markdown

Installation

Assuming you are using Scala 2.11.x, add the following line to your build file:

libraryDependencies += "com.github.tkqubo" % "html-to-markdown" % "0.3.0"

Quick Start

import com.github.tkqubo.html2md.Html2Markdown

val html = "<h1>introduction</h1><p>this is a <b>converter</b>.</p>"
val markdown = Html2Markdown.toMarkdown(html)
// markdown == "# introduction\n\nthis is a **converter**."

API

TBD

Writing your own rule

You can write your own HTML-to-markdown conversion rules. They can be represented as a simple tuple

TBD

// <br>
('br -> "\n")

// <p>
('p -> { content: String => s"\n\n$content\n\n" })

// <em> or <i>
(Seq('em, 'i) -> { content: String => s"_${content}_" })

// <a> with href attr
(
  { e: Element => e.tagName == "a" && e.hasAttr("href") } ->
  { (text: String, e: Element) =>
    val titlePart = if (e.hasAttr("title")) s""" "${e.attr("title")}"""" else ""
    s"""[$text](${e.attr("href")}$titlePart)"""
  }
)

TBD

Development

Test

sbt test

or, with coverage

sbt clean coverage test

Copyright

Copyright (c) 2015 tkqubo. See LICENSE for details.

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

Версия
0.8.3
0.8.2
0.7.2
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.3