Doc site syntax highlight style

This commit is contained in:
Dimitry Ivanov 2019-01-08 15:08:51 +03:00
parent 726d26b006
commit b3c685bfbc
3 changed files with 85 additions and 4 deletions

View File

@ -8,4 +8,64 @@ div[class~=language-proguard]:before {
div[class~=language-groovy]:before { div[class~=language-groovy]:before {
content:"gradle" content:"gradle"
} }
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;
}

View File

@ -21,7 +21,7 @@ but also gives all the means to tweak the appearance if desired. All markdown fe
listed in <Link name="commonmark-spec" /> are supported (including support for **inlined/block HTML code**, listed in <Link name="commonmark-spec" /> are supported (including support for **inlined/block HTML code**,
**markdown tables**, **images** and **syntax highlight**). **markdown tables**, **images** and **syntax highlight**).
## Supported markdown features: ## Supported markdown features
* Emphasis (`*`, `_`) * Emphasis (`*`, `_`)
* Strong emphasis (`**`, `__`) * Strong emphasis (`**`, `__`)

View File

@ -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)} * of static stateless methods). An instance of builder can be obtained via {@link #builder(Context)}
* method. * method.
* *
* @see #create(Context)
* @see #builder(Context) * @see #builder(Context)
* @see Builder * @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 * @param input markdown input to parse
* @return parsed via commonmark-java <code>org.commonmark.node.Node</code> * @return parsed via commonmark-java <code>org.commonmark.node.Node</code>
@ -56,10 +57,30 @@ public abstract class Markwon {
@NonNull @NonNull
public abstract Node parse(@NonNull String input); public abstract Node parse(@NonNull String input);
/**
* Create Spanned markdown from parsed Node (via {@link #parse(String)} call).
* <p>
* 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 <em>prepare</em>
* proper display.
*
* @since 3.0.0
*/
@NonNull @NonNull
public abstract Spanned render(@NonNull Node node); 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 @NonNull
public abstract Spanned toMarkdown(@NonNull String input); public abstract Spanned toMarkdown(@NonNull String input);