Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.

axvr/MdView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MdView for Xamarin.Forms

UNMAINTAINED. MdView is stable and shouldn't require much (if any) maintenance. If you would like to maintain it please contact me.

MdView is a highly customisable Markdown control for Xamarin.Forms. With MdView you can render Markdown such that it perfectly matches the design and behaviour of your app.

Xamarin Theme Custom Dark Theme

Usage

Note: MdView is currently in beta so backwards incompatible changes may happen. Backwards incompatible changes will be mentioned in the release notes.

Getting started

Install the MdView package from NuGet.org in the shared project of your app. Once installed add the namespace to your XAML file and start using MdView.

<ContentPage ...
             xmlns:md="clr-namespace:MdView;assembly=MdView"
             ...>
    <ScrollView>
        <md:MdView Markdown="Hello **world**!" />
    </ScrollView>
</ContentPage>

Customise

MdView is entirely based around data templates. Each Markdown element (e.g. paragraphs, images) has a corresponding data template which that MdView will use to render the Markdown.

Replacing and configuring a template is easy.

<ContentPage ...
             xmlns:md="clr-namespace:MdView;assembly=MdView"
             xmlns:mdt="clr-namespace:MdView.Templates;assembly=MdView"
             ...>
    <ScrollView>
        <md:MdView Markdown="# Heading 1">
            <!--
                Replace the default "Heading1Template" with a "MdView.Templates.Heading1"
                template configured with centred text.
            -->
            <md:MdView.Heading1Template>
                <mdt:Heading1 HorizontalTextAlignment="Center" />
            </md:MdView.Heading1Template>
        </md:MdView>
    </ScrollView>
</ContentPage>

The templates provided with MdView are highly customisable, however you may want to create your own custom ones to better integrate into your application or add new features. The best way to see how to create custom templates is to view/copy the source code of the default templates and the example templates in the sample project provided.

Note that you may want to create a custom "Markdown" control that sets default styles to use across your application. An example of this can be seen in the sample project.

Legal

The MdView library and source code is available under the terms of the Expat (MIT) licence. All documentation text and sample app code are dedicated to the public domain. The MdView logo is available under the CC BY-SA 4.0 licence. A more in depth legal description can be found in the accompanying LICENCE file.

MdView is a fork of MarkdownView.