Giter Club home page Giter Club logo

mdedit's Introduction

MDEdit - A Markdown source code editor with syntax highlighting and real-time preview.

License: GPL v3 Version

Introduction

MDEdit is a Markdown source code editor control for Avalonia applications.

This library provides a control that can be added to Avalonia windows and integrates:

  • A code editor with search/replace functions and syntax highlighting.

  • A panel showing a preview of the document.

  • A panel showing the save history of the file (that can persist across different sessions, if the application implements it properly).

  • A panel with general settings.

It uses a modified version of CSharpEditor for the source code editor panel, and VectSharp.Markdown to render the Markdown document preview.

MDEdit is a .NET Standard 2.1 library, and should be usable in .NET Core 3.0+ and .NET 5.0+ projects. It is released under a GPLv3 licence. You can find the full documentation for this library at the documentation website. A PDF reference manual is also available.

Getting started

First of all, you need to install the NuGet package in your project.

The editor control cannot be added directly to the Window in XAML code, because it requires some non-trivial initialisation; you can create a new Editor control using the static method Editor.Create and then add it to the window:

using MDEdit;

// ...
    Editor editor = await Editor.Create();

    Grid grid = this.FindControl<Grid>("EditorContainer");
    grid.Children.Add(editor);

The first time an Editor control is added to your window may take some time to initialise; subsequent Editor controls will be created much faster.

The Editor.Create static method has multiple parameters, all of which are optional:

  • string initialText: this is simply the initial source code that is shown in the control when it is created.

  • string guid: this parameter provides an identifier for the control. This will be used, in particular, to store the save history of the file. If the control is initialised with the same guid across different sessions, the save history of the file will be restored.

  • Shortcut[] additionalShortcuts: this makes it possible to display additional application-specific shortcuts in the shortcut section of the settings panel. Note that this does not actually implement the shortcut behaviour (which needs to be implemented separately by the developer) - it is simply provided so that users can open the settings panel and see all the shortcuts that can be used with the editor in the same place.

Take a look at the MainWindow.xaml.cs file in the MDEditDemo project to see how this works in practice.

mdedit's People

Contributors

arklumpus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mdedit's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.