Markdown to html android

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Markdown lets you easily display markdown data in android and its compose ready.

License

mukeshsolanki/MarkdownView-Android

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Читайте также:  Java замерить время выполнения метода

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

MarkdownView is a composable library that helps you display Markdown text or files on Android as a html page just like Github.

Supporting Compose Markdown View

Compose Markdown View is an independent project with ongoing development and support made possible thanks to your donations.

Its really simple to integrate Markdown in android. All you need to do make the following change to you build gradle under the app module.

Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:

allprojects < repositories < ... maven < url "https://jitpack.io" > > >

Step 2. Add the dependency

dependencies < implementation 'com.github.mukeshsolanki:MarkdownView-Android:2.0.0' >

Its fairly simple and straight forward to use Markdown in you application.

Just use MarkDown composable where you need to display the view like

MarkDown( url = URL("https://raw.githubusercontent.com/mukeshsolanki/MarkdownView-Android/main/README.md"), modifier = Modifier.fillMaxSize() )

Add a compose view in your xml file like

androidx.compose.ui.platform.ComposeView android:id="@+id/markdown" android:layout_width="match_parent" android:layout_height="match_parent" />

and reference it in your activity/fragment and assign the markdown text/file like wise.

val markdown = findViewById(R.id.markdown) markdown.composeView.apply < // Dispose of the Composition when the view's LifecycleOwner is destroyed setViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed) setContent < // In Compose world MaterialTheme < MarkDown( url = URL("https://raw.githubusercontent.com/mukeshsolanki/MarkdownView-Android/main/README.md"), modifier = Modifier.fillMaxSize() ) > > >

You have 3 different sources from where markdown data can be read

MarkDown( text = "# Test Markdown", modifier = Modifier.fillMaxSize() )
MarkDown( file = file, modifier = Modifier.fillMaxSize() )
MarkDown( url = URL("https://raw.githubusercontent.com/mukeshsolanki/MarkdownView-Android/main/README.md"), modifier = Modifier.fillMaxSize() )
Copyright (c) 2018 Mukesh Solanki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

About

Markdown lets you easily display markdown data in android and its compose ready.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

falnatsheh / MarkdownView Public archive

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

License

falnatsheh/MarkdownView

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

MarkdownView screenshot

MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and style the output using CSS.

The MarkdownView itself extends Android Webview and adds the necessary logic to parse Markdown (using MarkdownJ) and display the output HTML on the view.

dependencies  compile 'us.feras.mdv:markdownview:1.1.0' >

Add MarkdownView to your layout:

us.feras.mdv.MarkdownView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/markdownView" />

and reference it in your Activity/Fragment:

MarkdownView markdownView = (MarkdownView) findViewById(R.id.markdownView); markdownView.loadMarkdown("## Hello Markdown");

Note: You could also create the view by code. Below an example of how to set the whole activity to be a MarkdownView by Adding the following to your onCreate method:

MarkdownView markdownView = new MarkdownView(this); setContentView(markdownView); markdownView.loadMarkdown("## Hello Markdown");

The above screenshots taking from the demo app which could be found here. The demo app include code to demonstrate:

  • Loading Local Markdown File.
  • Loading Remote Markdown File.
  • Loading Markdown text.
  • Live Preview sample code (similar to Marked Mac app)
  • Themes

Loading Markdown text or file:

  • loadMarkdown(String text) : Using this method will result in loading md string to the MarkdownView and displaying it as HTML.
  • loadMarkdownFile(String url) : You can use this method to load local or online files.

To load a local file, you have to add it to your assets folder and pass a url that start with «file:///android_asset/» :

markdownView.loadMarkdownFile("file:///android_asset/myFile.md");

To load a remote file you need to pass the full url :

markdownView.loadMarkdownFile("http://www.my-site.com/myFile.md");

You could apply custom CSS to the MarkdownView. Example:

markdownView.loadMarkdownFile("file:///android_asset/hello.md","file:///android_asset/MyCustomTheme.css");

You could take a look at CSS example here, you could also view them in the sample app.

  • MarkdownView 1.1.0:
    • Support Loading Markdown file from assets subfolders (Thanks @echodjb).
    • Convert to Gradle Project (Avillable now on jCenter).
    • Fix CSS Issue (Thanks @swanson & @echodjb).
    • Update demo app.

    About

    MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

    Источник

    Saved searches

    Use saved searches to filter your results more quickly

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

    Android markdown library (no WebView)

    License

    noties/Markwon

    This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

    Name already in use

    A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

    Sign In Required

    Please sign in to use Codespaces.

    Launching GitHub Desktop

    If nothing happens, download GitHub Desktop and try again.

    Launching GitHub Desktop

    If nothing happens, download GitHub Desktop and try again.

    Launching Xcode

    If nothing happens, download Xcode and try again.

    Launching Visual Studio Code

    Your codespace will open once ready.

    There was a problem preparing your codespace, please try again.

    Latest commit

    Git stats

    Files

    Failed to load latest commit information.

    README.md

    Markwon is a markdown library for Android. It parses markdown following commonmark-spec with the help of amazing commonmark-java library and renders result as Android-native Spannables. No HTML is involved as an intermediate step. No WebView is required. It’s extremely fast, feature-rich and extensible.

    It gives ability to display markdown in all TextView widgets (TextView, Button, Switch, CheckBox, etc), Toasts and all other places that accept Spanned content. Library provides reasonable defaults to display style of a markdown content but also gives all the means to tweak the appearance if desired. All markdown features listed in commonmark-spec are supported (including support for inlined/block HTML code, markdown tables, images and syntax highlight).

    Markwon comes with a sample application. It is a collection of library usages that comes with search and source code for each code sample.

    Since version 4.2.0 Markwon comes with an editor to highlight markdown input as user types (for example in EditText).

    implementation "io.noties.markwon:core:$ "

    Full list of available artifacts is present in the install section of the documentation web-site.

    Please visit documentation web-site for further reference.

    You can find previous version of Markwon in 2.x.x and 3.x.x branches

    Supported markdown features:

    • Emphasis ( * , _ )
    • Strong emphasis ( ** , __ )
    • Strike-through ( ~~ )
    • Headers ( # )
    • Links ( []() && [][] )
    • Images
    • Thematic break ( — , *** , ___ )
    • Quotes & nested quotes ( >)
    • Ordered & non-ordered lists & nested ones
    • Inline code
    • Code blocks
    • Tables (with limitations)
    • Syntax highlight
    • LaTeX formulas
    • HTML
      • Emphasis ( , , , )
      • Strong emphasis ( , )
      • SuperScript ( )
      • SubScript ( )
      • Underline ( , ins )
      • Strike-through ( , , )
      • Link ( a )
      • Lists ( ul , ol )
      • Images ( img will require configured image loader)
      • Blockquote ( blockquote )
      • Heading ( h1 , h2 , h3 , h4 , h5 , h6 )
      • there is support to render any HTML tag
      • Not done
        • Done with X
        • and or small x

        Taken with default configuration (except for image loading) in sample app:

        By default configuration uses TextView textColor for styling, so changing textColor changes style

        Please visit documentation web-site for reference

        Paid consulting is available. Please reach me out at markwon+consulting[at]noties.io to discuss your idea or a project

        Источник

Оцените статью