Skip to content

Commit

Permalink
Add markdown support
Browse files Browse the repository at this point in the history
  • Loading branch information
EdrowsLuo committed Dec 8, 2020
1 parent 5864389 commit 36594a0
Show file tree
Hide file tree
Showing 22 changed files with 587 additions and 6 deletions.
5 changes: 3 additions & 2 deletions AndEngine/src/org/anddev/andengine/util/StreamUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ public class StreamUtils {
// ===========================================================

public static final String readFully(final InputStream pInputStream) throws IOException {
final StringBuilder sb = new StringBuilder();
/*final StringBuilder sb = new StringBuilder();
final Scanner sc = new Scanner(pInputStream);
while(sc.hasNextLine()) {
sb.append(sc.nextLine());
}
return sb.toString();
return sb.toString();*/
return new String(streamToBytes(pInputStream), "UTF-8");
}

public static byte[] streamToBytes(final InputStream pInputStream) throws IOException {
Expand Down
3 changes: 0 additions & 3 deletions LibBASS/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ android {
targetSdkVersion 27
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}

buildTypes {
Expand Down
1 change: 1 addition & 0 deletions andnext_markdown/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
27 changes: 27 additions & 0 deletions andnext_markdown/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 29
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.0.0'
}
Empty file.
21 changes: 21 additions & 0 deletions andnext_markdown/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions andnext_markdown/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="club.andnext.markdown" />
78 changes: 78 additions & 0 deletions andnext_markdown/src/main/assets/AndroidMarkdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8"/>

<meta name="viewport" content="width=device-width, initial-scale=1"/>

<link
rel="stylesheet"
href="./github-markdown-css/2.10.0/github-markdown.min.css"
/>

<style>
.markdown-body
{
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}

@media (max-width: 767px)
{
.markdown-body
{
padding: 15px;
}
}
</style>

<link rel="stylesheet"
href="./highlightjs/9.13.1/default.min.css">

<script src="./highlightjs/9.13.1/highlight.min.js"></script>

<script type='text/javascript' src='./marked/0.5/marked.min.js'></script>

<script>
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: true,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight: function (code, lang) {
if (lang && hljs.getLanguage(lang)) {
return hljs.highlight(lang, code, true).value;
} else {
return hljs.highlightAuto(code).value;
}
}
});


</script>

<script type="text/javascript">
function setText(text) {
var result = marked(text);

var element = document.getElementById('marked');
element.innerHTML = result;
}
</script>

</head>

<body>
<article id="marked" class="markdown-body" style="text-align: left;">
</article>
</body>

</html>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions andnext_markdown/src/main/assets/marked/0.5/marked.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 36594a0

Please sign in to comment.