MarkdownSharp.Markdown.Transform C# (CSharp) Méthode

Transform() public méthode

Transforms the provided Markdown-formatted text to HTML; see http://en.wikipedia.org/wiki/Markdown
The order in which other subs are called here is essential. Link and image substitutions need to happen before EscapeSpecialChars(), so that any *'s or _'s in the a and img tags get encoded.
public Transform ( string text ) : string
text string
Résultat string
        public string Transform(string text)
        {
            if (String.IsNullOrEmpty(text)) return "";

            Setup();

            text = Normalize(text);
           
            text = HashHTMLBlocks(text);
            text = StripLinkDefinitions(text);
            text = RunBlockGamut(text);
            text = Unescape(text);

            Cleanup();

            return text + "\n";
        }

Usage Example

        public static void Configure()
        {
            var options = new MarkdownOptions { AutoHyperlink = true };
            var converter = new Markdown(options);

            Mapper.CreateMap<Entry, EntryViewModel>()
                // convert content from markdown to html
                .ForMember(entry => entry.Content,
                    expression => expression.ResolveUsing(source => converter.Transform(source.Content)))
                // convert summary from markdown to html
                .ForMember(entry => entry.Summary,
                    expression => expression.ResolveUsing(source => converter.Transform(source.Summary)));

            // convert the closed type of the derived generic list
            Mapper.CreateMap<PagedList<Entry>, PagedList<EntryViewModel>>()
                .AfterMap((entity, model) => Mapper.Map<List<Entry>, List<EntryViewModel>>(entity, model));

            Mapper.CreateMap<EntryInput, Entry>()
                .ForMember(entry => entry.Slug, expression => expression.MapFrom(
                    entry => SlugConverter.Convert(entry.Header)))
                .ForMember(entry => entry.Tags, expression => expression.MapFrom(
                    entry => TagsResolver.ResolveTags(entry.Tags)));

            Mapper.CreateMap<Entry, EntryInput>()
                .ForMember(entry => entry.Tags, opt => opt.MapFrom(
                    entry => TagsResolver.ResolveTags(entry.Tags)));

            Mapper.CreateMap<Entry, EntryInput>();
        }
All Usage Examples Of MarkdownSharp.Markdown::Transform