All Projects → patridge → Markdownsharp.portable

patridge / Markdownsharp.portable

Licence: mit
Fork of MarkdownSharp with a focus on making it a portable class library (PCL).

Projects that are alternatives of or similar to Markdownsharp.portable

XamarinClipboardPlugin
Cross Platform Clipboard access for Xamarin
Stars: ✭ 24 (+71.43%)
Mutual labels:  xamarin, pcl
Xam.plugin.webview
Xamarin Plugin for a HybridWebView in PCL projects.
Stars: ✭ 132 (+842.86%)
Mutual labels:  pcl, xamarin
Connectivityplugin
Connectivity Plugin for Xamarin and Windows
Stars: ✭ 253 (+1707.14%)
Mutual labels:  pcl, xamarin
ScreenshotPlugin
A simple Screenshot plugin for Xamarin and Windows to get and save screenshot in yours apps.
Stars: ✭ 32 (+128.57%)
Mutual labels:  xamarin, pcl
ButtonCirclePlugin
Circle Buttons with icon for your Xamarin.Forms Applications
Stars: ✭ 96 (+585.71%)
Mutual labels:  xamarin, pcl
Msbuildsdkextras
Extra properties for MSBuild SDK projects
Stars: ✭ 288 (+1957.14%)
Mutual labels:  pcl, xamarin
Geolocatorplugin
Geolocation plugin for Xamarin and Windows
Stars: ✭ 257 (+1735.71%)
Mutual labels:  pcl, xamarin
Mathparser.org Mxparser
Math Parser Java Android C# .NET/MONO (.NET Framework, .NET Core, .NET Standard, .NET PCL, Xamarin.Android, Xamarin.iOS) CLS Library - a super easy, rich and flexible mathematical expression parser (expression evaluator, expression provided as plain text / strings) for JAVA and C#. Main features: rich built-in library of operators, constants, math functions, user defined: arguments, functions, recursive functions and general recursion (direct / indirect). Additionally parser provides grammar and internal syntax checking.
Stars: ✭ 624 (+4357.14%)
Mutual labels:  pcl, xamarin
Libvlcsharp
Cross-platform .NET/Mono bindings for LibVLC
Stars: ✭ 752 (+5271.43%)
Mutual labels:  xamarin
Xtoolkit.whitelabel
Modular MVVM framework for fast creating powerful cross-platform applications with Xamarin.
Stars: ✭ 22 (+57.14%)
Mutual labels:  xamarin
Xamarin.forms.pancakeview
An extended ContentView for Xamarin.Forms with rounded corners, borders, shadows and more!
Stars: ✭ 744 (+5214.29%)
Mutual labels:  xamarin
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+47821.43%)
Mutual labels:  xamarin
Realm Dotnet
Realm is a mobile database: a replacement for SQLite & ORMs
Stars: ✭ 927 (+6521.43%)
Mutual labels:  xamarin
Microsoft Authentication Library For Dotnet
Microsoft Authentication Library (MSAL) for .NET
Stars: ✭ 746 (+5228.57%)
Mutual labels:  xamarin
Csla
A home for your business logic in any .NET application.
Stars: ✭ 865 (+6078.57%)
Mutual labels:  xamarin
Embeddinator 4000
Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
Stars: ✭ 735 (+5150%)
Mutual labels:  xamarin
Pcl
Point Cloud Library (PCL)
Stars: ✭ 6,897 (+49164.29%)
Mutual labels:  pcl
Formswpflive
Live XAML development for Xamarin Forms Apps using WPF Backend.
Stars: ✭ 14 (+0%)
Mutual labels:  xamarin
Realm.json.extensions
Extension Methods for adding JSON APIs to a Realm Instance
Stars: ✭ 9 (-35.71%)
Mutual labels:  xamarin
Wechatsdk Xamarin
Xamarin.Android and Xamarin.iOS binding for Wechat SDK
Stars: ✭ 17 (+21.43%)
Mutual labels:  xamarin

MarkdownSharp.Portable

Fork of MarkdownSharp with a focus on making it a portable class library (PCL).

Usage

Markdown markdown = new Markdown();
string markdownHtml = markdown.Transform(someMarkdownText);

From there, you can dump that HTML into an Android WebView:

yourWebView.LoadData(markdownHtml, "text/html", null);

Or you can toss that HTML at an iOS UIWebView:

string contentDirectoryPath = Path.Combine(NSBundle.MainBundle.BundlePath, "Content/");
webView.LoadHtmlString(markdownHtml, new NSUrl(contentDirectoryPath, true));

Why a fork?

I really don't have a good reason to fork except that it looks like making this portable would break some existing functionality and/or execution expectations. I would happily submit this to the original project and point everyone hitting this repo back over there if it is ever the desired direction.

The original MarkdownSharp had a couple items that kept it from being usable in a portable class library or being referenced by a Xamarin.iOS/Xamarin.Android project. First, it offered a constructor that pulled settings from ConfigurationManager.AppSettings (via the System.Configuration namespace). Second, it used RegexOptions.Compiled for most regexes. This fork removes the configuration-settings constructor and set all uses of RegexOptions.Compiled to RegexOptions.None.

Need compiled regexes?

When switching to RegexOptions.None, the setting was extracted to a central variable in the Markdown class. If you want to test compilation on a platform that supports it; go find that variable, switch it to Compiled, and rebuild.

private static RegexOptions _defaultRegexOptions = RegexOptions.Compiled;

Another option may be to use pre-compiled regexes, but I haven't poked at how that plays with portability yet.

Need the original loadOptionsFromConfigFile (ConfigurationManager.AppSettings) constructor?

Since configuration can still be done by passing in a instance of MarkdownOptions, you will need to do the logic the old constructor did for you before creating a new instance of Markdown.

var options = new MarkdownOptions();
var appSettings = ConfigurationManager.AppSettings;
foreach (string key in appSettings.Keys)
{
    switch (key)
    {
        case "Markdown.AutoHyperlink":
            options.AutoHyperlink = Convert.ToBoolean(settings[key]);
            break;
        case "Markdown.AutoNewlines":
            options.AutoNewlines = Convert.ToBoolean(settings[key]);
            break;
        case "Markdown.EmptyElementSuffix":
            options.EmptyElementSuffix = settings[key];
            break;
        case "Markdown.EncodeProblemUrlCharacters":
            options.EncodeProblemUrlCharacters = Convert.ToBoolean(settings[key]);
            break;
        case "Markdown.LinkEmails":
            options.LinkEmails = Convert.ToBoolean(settings[key]);
            break;
        case "Markdown.StrictBoldItalic":
            options.StrictBoldItalic = Convert.ToBoolean(settings[key]);
            break;
    }
}
var markdown = new Markdown(options);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].