当前位置: 首页>>代码示例>>C#>>正文


C# MarkdownDeep.Markdown类代码示例

本文整理汇总了C#中MarkdownDeep.Markdown的典型用法代码示例。如果您正苦于以下问题:C# Markdown类的具体用法?C# Markdown怎么用?C# Markdown使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Markdown类属于MarkdownDeep命名空间,在下文中一共展示了Markdown类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompiledContent

        public static IHtmlString CompiledContent(this IDynamicContent contentItem, bool trustContent = false)
        {
            if (contentItem == null) return NonEncodedHtmlString.Empty;

            switch (contentItem.ContentType)
            {
                case DynamicContentType.Markdown:
                    var md = new Markdown
                    {
                        AutoHeadingIDs = true,
                        ExtraMode = true,
                        NoFollowLinks = !trustContent,
                        SafeMode = false,
                        NewWindowForExternalLinks = true,
                    };

                    var contents = contentItem.Content;
                    // TODO contents = CodeBlockFinder.Replace(contents, match => GenerateCodeBlock(match.Groups[1].Value.Trim(), match.Groups[2].Value));
                    contents = md.Transform(contents);
                    return new NonEncodedHtmlString(contents);
                case DynamicContentType.Html:
                    return trustContent ? new NonEncodedHtmlString(contentItem.Content) : NonEncodedHtmlString.Empty;
            }
            return NonEncodedHtmlString.Empty;
        }
开发者ID:jchannon,项目名称:NSemble,代码行数:25,代码来源:DynamicContentHelpers.cs

示例2: Main

        static void Main(string[] args)
        {
            Markdown m = new Markdown();
            m.SafeMode = false;
            m.ExtraMode = true;
            m.AutoHeadingIDs = true;
            //			m.SectionHeader = "<div class=\"header\">{0}</div>\n";
            //			m.SectionHeadingSuffix = "<div class=\"heading\">{0}</div>\n";
            //			m.SectionFooter = "<div class=\"footer\">{0}</div>\n\n";
            //			m.SectionHeader = "\n<div class=\"section_links\"><a href=\"/edit?section={0}\">Edit</a></div>\n";
            //			m.HtmlClassTitledImages = "figure";
            //			m.DocumentRoot = "C:\\users\\bradr\\desktop";
            //			m.DocumentLocation = "C:\\users\\bradr\\desktop\\100D5000";
            //			m.MaxImageWidth = 500;

            string markdown=FileContents("input.txt");
            string str = m.Transform(markdown);
            Console.Write(str);

            var sections = MarkdownDeep.Markdown.SplitSections(markdown);
            for (int i = 0; i < sections.Count; i++)
            {
                Console.WriteLine("---- Section {0} ----", i);
                Console.Write(sections[i]);
                Console.WriteLine("\n");
            }
            Console.WriteLine("------------------");
        }
开发者ID:arronei,项目名称:markdowndeep,代码行数:28,代码来源:Program.cs

示例3: ResolveMarkdown

        public static string ResolveMarkdown(this string content, IDocsOutput output, string currentSlug)
        {
            // http://www.toptensoftware.com/markdowndeep/api
            var md = new Markdown
                        {
                            AutoHeadingIDs = true,
                            ExtraMode = true,
                            NoFollowLinks = false,
                            SafeMode = false,
                            HtmlClassTitledImages = "figure",
                            UrlRootLocation = output.RootUrl,
                        };

            if (!string.IsNullOrWhiteSpace(output.RootUrl))
            {
                if (!string.IsNullOrWhiteSpace(currentSlug) && !currentSlug.Equals("index"))
                    md.UrlBaseLocation = output.RootUrl + "/" + currentSlug.Replace('\\', '/');
                else
                    md.UrlBaseLocation = output.RootUrl;
            }

            ////if (!string.IsNullOrWhiteSpace(output.ImagesPath))
            //    md.QualifyUrl = delegate(string image) { return output.ImagesPath + "/" + image; };

            md.PrepareImage = (tag, titledImage) => PrepareImage(output.ImagesPath, tag);

            return md.Transform(content);
        }
开发者ID:kyanha,项目名称:docs,代码行数:28,代码来源:DocumentationParser.cs

示例4: CreateRenderer

        public static MarkdownDeep.Markdown CreateRenderer()
        {
            var result = new MarkdownDeep.Markdown {SafeMode = true, ExtraMode = true};
            result.FormatCodeBlock += FormatCodeBlock;

            return result;
        }
开发者ID:BernhardGlueck,项目名称:DevPost,代码行数:7,代码来源:MarkdownHelper.cs

示例5: Show

        public ActionResult Show(string page)
        {
            if (page == "" || page == null)
                page = "README";
            string path = string.Concat(HttpContext.Request.PhysicalApplicationPath, "\\Docs\\", page, ".md");
            string contents;

            try
            {
                using (StreamReader sr = new StreamReader(path))
                {
                    Markdown md = new Markdown();
                    contents = md.Transform(sr.ReadToEnd());

                }

                ViewBag.ConvertedMarkdown = contents;
                return View();
            }
            catch (Exception ex)
            {
                this.Response.StatusCode = 404;
                ViewBag.ConvertedMarkdown = "File not found.";
                return View();
            }
        }
开发者ID:szwork2013,项目名称:BoiPlt,代码行数:26,代码来源:DocsController.cs

示例6: GetDocument

 private Negotiator GetDocument(IDocumentFolder documentFolder, string path)
 {
     var markdown = documentFolder.ReadAllText(path);
     var converter = new Markdown();
     var html = converter.Transform(markdown);
     return View["Index", new { Title = path, Content = html }];
 }
开发者ID:rlipscombe,项目名称:vs-welcome-page,代码行数:7,代码来源:HomeModule.cs

示例7: FormatCodePrettyPrint

        public static string FormatCodePrettyPrint(Markdown m, string code)
        {
            var match = rxExtractLanguage.Match(code);
            string language = null;

            if (match.Success)
            {
                // Save the language
                var g=(Group)match.Groups[2];
                language = g.ToString();

                // Remove the first line
                code = code.Substring(match.Groups[1].Length);
            }

            if (language == null)
            {
                var d = m.GetLinkDefinition("default_syntax");
                if (d!=null)
                    language = d.title;
            }
            if (language == "C#")
                language = "csharp";
            if (language == "C++")
                language = "cpp";

            if (string.IsNullOrEmpty(language))
                return string.Format("<pre><code>{0}</code></pre>\n", code);
            else
                return string.Format("<pre class=\"prettyprint lang-{0}\"><code>{1}</code></pre>\n", language.ToLowerInvariant(), code);
        }
开发者ID:pazof,项目名称:markdowndeep,代码行数:31,代码来源:Program.cs

示例8: Markdown

 public static string Markdown(string text)
 {
     if (text == null)
         return "";
     var md = new Markdown();
     return md.Transform(text.Trim());
 }
开发者ID:clearfunction,项目名称:bvcms,代码行数:7,代码来源:Misc.cs

示例9: CompiledContent

        public static MvcHtmlString CompiledContent(this IDynamicContent contentItem, bool trustContent)
        {
            if (contentItem == null) return MvcHtmlString.Empty;

            switch (contentItem.ContentType)
            {
                case DynamicContentType.Markdown:
                    var md = new Markdown
                    {
                        AutoHeadingIDs = true,
                        ExtraMode = true,
                        NoFollowLinks = !trustContent,
                        SafeMode = false,
                        NewWindowForExternalLinks = true,
                    };

                    var contents = contentItem.Body;
                    contents = CodeBlockFinder.Replace(contents, match => GenerateCodeBlock(match.Groups[1].Value.Trim(), match.Groups[2].Value));

                    try
                    {
                        contents = md.Transform(contents);
                    }
                    catch (Exception)
                    {
                        contents = string.Format("<pre>{0}</pre>", HttpUtility.HtmlEncode(contents));
                    }

                    return MvcHtmlString.Create(contents);
                case DynamicContentType.Html:
                    return trustContent ? MvcHtmlString.Create(contentItem.Body) : MvcHtmlString.Empty;
            }
            return MvcHtmlString.Empty;
        }
开发者ID:OpenMind,项目名称:VulcanBlog,代码行数:34,代码来源:DynamicContentHelpers.cs

示例10: StaticContentServiceImpl

 public StaticContentServiceImpl(string baseLocalPath, Markdown markdownRender, ShopifyLiquidThemeEngine liquidEngine, ICacheManager<object> cacheManager)
 {
     _baseLocalPath = baseLocalPath;
     _markdownRender = markdownRender;
     _liquidEngine = liquidEngine;
     _fileSystemWatcher = MonitorContentFileSystemChanges();
     _cacheManager = cacheManager;
 }
开发者ID:adwardliu,项目名称:vc-community,代码行数:8,代码来源:StaticContentServiceImpl.cs

示例11: MarkdownProcessor

 public MarkdownProcessor()
 {
     _processor = new Markdown
     {
         ExtraMode = true,
         NewWindowForExternalLinks = true
     };
 }
开发者ID:xb11,项目名称:Website,代码行数:8,代码来源:MarkdownProcessor.cs

示例12: DALMunicipiosRepository

        public DALMunicipiosRepository(string connectionString)
        {
            objMarkDown = new Markdown();
            objMarkDown.ExtraMode = true;
            objMarkDown.SafeMode = true;

            _connectionString = connectionString;
        }
开发者ID:equiman,项目名称:FMS,代码行数:8,代码来源:CMunicipiosRepository.cs

示例13: PostController

 public PostController(IRepository<Post> postRepo)
 {
     Posts = postRepo;
     Markdown = new Markdown()
                    {
                        ExtraMode = true
                    };
 }
开发者ID:pate,项目名称:blog,代码行数:8,代码来源:PostController.cs

示例14: ShowReleaseNotesDialog_Load

		private void ShowReleaseNotesDialog_Load(object sender, EventArgs e)
		{
			string contents = File.ReadAllText(_path);

			var md = new Markdown();
			_temp = TempFile.WithExtension("htm"); //enhance: will leek a file to temp
			File.WriteAllText(_temp.Path, md.Transform(contents));
			_browser.Url = new Uri(_temp.Path);
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:9,代码来源:ShowReleaseNotesDialog.cs

示例15: Markdown

        /// <summary>
        /// Transforms a string of Markdown into HTML.
        /// </summary>
        /// <param name="text">The Markdown that should be transformed.</param>
        /// <returns>The HTML representation of the supplied Markdown.</returns>
        public static IHtmlString Markdown(string text)
        {
            // Transform the supplied text (Markdown) into HTML.
            var markdownTransformer = new Markdown();
            var html = markdownTransformer.Transform(text);

            // Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
            return html.ToHtmlString();
        }
开发者ID:Code52,项目名称:Ideastrike,代码行数:14,代码来源:MarkdownHelper.cs


注:本文中的MarkdownDeep.Markdown类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。