From b3c685bfbcf7357bc7b55e61db1da73a815d4d96 Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Tue, 8 Jan 2019 15:08:51 +0300 Subject: [PATCH] Doc site syntax highlight style --- docs/.vuepress/style.styl | 62 ++++++++++++++++++- docs/README.md | 2 +- .../main/java/ru/noties/markwon/Markwon.java | 25 +++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/docs/.vuepress/style.styl b/docs/.vuepress/style.styl index cae5a235..6ec59aba 100644 --- a/docs/.vuepress/style.styl +++ b/docs/.vuepress/style.styl @@ -8,4 +8,64 @@ div[class~=language-proguard]:before { div[class~=language-groovy]:before { content:"gradle" -} \ No newline at end of file +} + +div[class*="language-"] { + background-color: #2d2d2d; +} + +.token.comment, .token.prolog, .token.cdata { + color: #808080; +} + +.token.delimiter, .token.boolean, .token.keyword, .token.selector, .token.important, .token.atrule { + color: #cc7832; +} + +.token.operator, .token.punctuation, .token.attr-name { + color: #a9b7c6; +} + +.token.tag, .token.doctype, .token.builtin { + color: #e8bf6a; +} + +.token.entity, .token.number, .token.symbol { + color: #6897bb; +} + +.token.property, .token.constant, .token.variable { + color: #9876aa; +} + +.token.string, .token.char { + color: #6a8759; +} + +.token.annotation { + color: #bbb438; +} + +.token.attr-value { + color: #a5c261; +} + +.token.url { + color: #287bde; +} + +.token.function { + color: #ffc66d; +} + +.token.regex { + color: #364135; +} + +.token.inserted { + color: #294436; +} + +.token.deleted { + color: #484a4a; +} diff --git a/docs/README.md b/docs/README.md index 498f873d..a2752665 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ but also gives all the means to tweak the appearance if desired. All markdown fe listed in are supported (including support for **inlined/block HTML code**, **markdown tables**, **images** and **syntax highlight**). -## Supported markdown features: +## Supported markdown features * Emphasis (`*`, `_`) * Strong emphasis (`**`, `__`) diff --git a/markwon-core/src/main/java/ru/noties/markwon/Markwon.java b/markwon-core/src/main/java/ru/noties/markwon/Markwon.java index ee6e14cd..bf963995 100644 --- a/markwon-core/src/main/java/ru/noties/markwon/Markwon.java +++ b/markwon-core/src/main/java/ru/noties/markwon/Markwon.java @@ -14,6 +14,7 @@ import ru.noties.markwon.core.CorePlugin; * of static stateless methods). An instance of builder can be obtained via {@link #builder(Context)} * method. * + * @see #create(Context) * @see #builder(Context) * @see Builder */ @@ -46,7 +47,7 @@ public abstract class Markwon { } /** - * Method to simply parse markdown (without rendering) + * Method to parse markdown (without rendering) * * @param input markdown input to parse * @return parsed via commonmark-java org.commonmark.node.Node @@ -56,10 +57,30 @@ public abstract class Markwon { @NonNull public abstract Node parse(@NonNull String input); + /** + * Create Spanned markdown from parsed Node (via {@link #parse(String)} call). + *

+ * Please note that returned Spanned has few limitations. For example, images, tables + * and ordered lists require TextView to be properly displayed. This is why images and tables + * most likely won\'t work in this case. Ordered lists might have mis-measurements. Whenever + * possible use {@link #setMarkdown(TextView, String)} or {@link #setParsedMarkdown(TextView, Spanned)} + * as these methods will additionally call specific {@link MarkwonPlugin} methods to prepare + * proper display. + * + * @since 3.0.0 + */ @NonNull public abstract Spanned render(@NonNull Node node); - // parse + render + /** + * This method will {@link #parse(String)} and {@link #render(Node)} supplied markdown. Returned + * Spanned has the same limitations as from {@link #render(Node)} method. + * + * @param input markdown input + * @see #parse(String) + * @see #render(Node) + * @since 3.0.0 + */ @NonNull public abstract Spanned toMarkdown(@NonNull String input);