• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MarkdownDeep.Markdown类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PreviewForUnpublishedPostTest

        public void PreviewForUnpublishedPostTest()
        {
            IRepository<Post> postRepo = new SimpleRepository<Post>(new InMemoryRepositoryDataSource<Post>(new List<Post> { 
                new Post { Status = PostStatus.Published, Path ="2013/04/10/some-other-post", Posted = new DateTime(2013,4,10), Author = new User{ Email = "" }, BlogId = 1 },
                new Post { 
                    Id = 1,
                    Status = PostStatus.Unpublished, 
                    Path ="2013/04/14/some-post", 
                    Posted = new DateTime(2013,4,14), 
                    Author = new User{ Email = "", FirstName = "Joe", LastName = "Bloggs" },
                    DraftBody = "asdf",
                    DraftTitle = "qwerty", 
                    BlogId = 1
                }
            }));

            PostController sut = new PostController(postRepo, null, _blogRepo, _mockHttpContext.Object);
            var result = (ViewResult)sut.Preview(1);

            Assert.IsNotNull(result);
            var model = result.Model as PostModel;
            Assert.IsNotNull(model);

            var md = new MarkdownDeep.Markdown();
            Assert.AreEqual("Joe Bloggs", model.Author.Name);
            Assert.AreEqual(md.Transform("asdf"), model.Body);
            Assert.AreEqual("qwerty", model.Title);
        }
开发者ID:stilldesign,项目名称:StaticVoid.Blog,代码行数:28,代码来源:PostControllerPreviewTests.cs


示例2: SetMessage

 private void SetMessage(string text)
 {
     var md = new MarkdownDeep.Markdown();
     md.ExtraMode = true;
     md.SafeMode = false;
     ViewBag.Message = md.Transform(text);
 }
开发者ID:moonavw,项目名称:testlab,代码行数:7,代码来源:WikiController.cs


示例3: renderPage

        private void renderPage(object sender, System.Timers.ElapsedEventArgs e)
        {
            DateTime lastWrite = File.GetLastWriteTime(fileName);
            if (lastWrite != latestWrite)
            {
                latestWrite = lastWrite;

                var md = new MarkdownDeep.Markdown();
                md.SafeMode = false;

                TextReader infile = new StreamReader(fileName);
                String input = infile.ReadToEnd();
                infile.Close();

                String output;
                if (jekyllMode)
                {
                    output = md.Transform(Regex.Replace(input, @"---[\p{IsBasicLatin}]+---\r", ""));
                }
                else
                {
                    output = md.Transform(input);
                }
                webTargetPage.DocumentText = output;
            }
        }
开发者ID:dHeinemann,项目名称:Mark-My-Words,代码行数:26,代码来源:frmMain.cs


示例4: RunTestJS

        public static void RunTestJS(string input, bool SafeMode, bool ExtraMode, bool MarkdownInHtml, bool AutoHeadingIDs)
        {
            string normalized_input = input.Replace("\r\n", "\n").Replace("\r", "\n");

            // Work out the expected output using C# implementation
            var md = new MarkdownDeep.Markdown();
            md.SafeMode = SafeMode;
            md.ExtraMode = ExtraMode;
            md.MarkdownInHtml = MarkdownInHtml;
            md.AutoHeadingIDs = AutoHeadingIDs;
            string expected = md.Transform(normalized_input);

            // Transform using javascript implementation
            string actual = TransformUsingJS(input, SafeMode, ExtraMode, MarkdownInHtml, AutoHeadingIDs);

            actual = actual.Replace("\r", "");
            expected = expected.Replace("\r", "");

            string sep = new string('-', 30) + "\n";

            Console.WriteLine("Input:\n" + sep + input);
            Console.WriteLine("Actual:\n" + sep + actual);
            Console.WriteLine("Expected:\n" + sep + expected);

            // Check it
            Assert.AreEqual(expected, actual);
        }
开发者ID:FransBouma,项目名称:markdowndeep,代码行数:27,代码来源:Utils.cs


示例5: GenerateFeed

		private SyndicationFeed GenerateFeed()        
        {
            var currentBlog = this.CurrentBlog;

            var md = new MarkdownDeep.Markdown();
            List<SyndicationItem> posts = new List<SyndicationItem>();
            foreach (var post in _postRepository.FeedPosts(currentBlog.Id).OrderByDescending(p => p.Posted).Take(25).AsEnumerable())
            {
                var item = new SyndicationItem(post.Title, post.Body, new Uri(currentBlog.AuthoritiveUrl.TrimEnd('/') + "/" + post.Path.TrimStart('/')));

                item.Title = new TextSyndicationContent(post.Title);
                item.Content = new TextSyndicationContent(md.Transform(post.Body), TextSyndicationContentKind.Html);
                item.PublishDate = new DateTimeOffset(post.Posted);
                item.LastUpdatedTime = new DateTimeOffset(post.Posted);
                item.Id = post.PostGuid.ToString();
                                
                posts.Add(item);
            }


            return new SyndicationFeed("StaticVoid", "A blog on .Net", new Uri(currentBlog.AuthoritiveUrl), posts)
			{
				Language = "en-US",
                LastUpdatedTime = posts.Any() ? posts.Max(p=>p.LastUpdatedTime) : new DateTime(2012,12,21),
                Id = currentBlog.BlogGuid.ToString()
			};
		}
开发者ID:stilldesign,项目名称:StaticVoid.Blog,代码行数:27,代码来源:FeedController.cs


示例6: Linkify

        public void Linkify(string text, Action<string> onSuccess)
        {
            text = Regex.Replace(text, @"(http\://|https\://|www.)\S*", match => {
            if (match.Index != 0)
            {
               var previousChar = text[match.Index - 1];

               if (!char.IsWhiteSpace(previousChar))
                  return match.Value;
            }

            var value = match.Value;
            var path = new UriBuilder(value).Uri.AbsolutePath;

            if (match.Groups[1].Value == "www.")
               value = "http://" + value;

            return path.EndsWith("jpg") || path.EndsWith("gif") || path.EndsWith("png")
                  ? "![Inline Image](" + value + ")"
                  : "[" + value + "](" + value + ")";
             });
             text = new MarkdownDeep.Markdown {
            ExtraMode = true,
            NewWindowForExternalLinks = true,
            NewWindowForLocalLinks = true,
             }.Transform(text);
             text = text.Replace("\n", "");
             text = text.Replace(@"\", @"\\");

             onSuccess(text);
        }
开发者ID:dustyburwell,项目名称:jell,代码行数:31,代码来源:ChatLogView.xaml.cs


示例7: RunResourceTest

        public static void RunResourceTest(string resourceName)
        {
            string input = Utils.LoadTextResource(resourceName);
            string expected = Utils.LoadTextResource(System.IO.Path.ChangeExtension(resourceName, "html"));

            var md = new MarkdownDeep.Markdown();
            md.SafeMode = resourceName.IndexOf("(SafeMode)") >= 0;
            md.ExtraMode = resourceName.IndexOf("(ExtraMode)") >= 0;
            md.GitHubCodeBlocks = resourceName.IndexOf("(GitHubMode)") >= 0;
            md.DocNetMode = resourceName.IndexOf("(DocNetMode") >= 0;
            md.MarkdownInHtml = resourceName.IndexOf("(MarkdownInHtml)") >= 0;
            md.AutoHeadingIDs = resourceName.IndexOf("(AutoHeadingIDs)") >= 0;
            if(resourceName.IndexOf("(Titled)") >= 0)
            {
                md.HtmlClassTitledImages = "figure";
            }
            if(md.DocNetMode)
            {
                md.GitHubCodeBlocks = true;
            }

            string actual = md.Transform(input);
            string actual_clean = Utils.strip_redundant_whitespace(actual);
            string expected_clean = Utils.strip_redundant_whitespace(expected);

            string sep = new string('-', 30) + "\n";

            Console.WriteLine("Input:\n" + sep + input);
            Console.WriteLine("Actual:\n" + sep + actual);
            Console.WriteLine("Expected:\n" + sep + expected);

            Assert.AreEqual(expected_clean, actual_clean);
        }
开发者ID:FransBouma,项目名称:DocNet,代码行数:33,代码来源:Utils.cs


示例8: ViewFeedback

        //
        // GET: /Project/Feedback/projectid
        //
        // Updated to v2.0 w/ audit trails
        public ActionResult ViewFeedback(int projectid = 0)
        {
            Mapper.CreateMap<ProjectVersion, ProjectView>();
            Mapper.CreateMap<Project, ProjectView>();

            Project project = db.Projects.Find(projectid);

            ProjectView feedbackProject = Mapper.Map<Project, ProjectView>(project);
            Mapper.Map(project.CurrentVersion, feedbackProject);

            feedbackProject.Feedbacks = db.Feedbacks.Where(b => b.owner.ProjectId.Equals(projectid)).ToList();

            //takes the comment and turns it into markedup html
            var md = new MarkdownDeep.Markdown();
            md.ExtraMode = true;
            md.SafeMode = false;

            foreach (var feedback in feedbackProject.Feedbacks)
            {
                string MarkedUp = md.Transform(feedback.Comment);
                feedback.Comment = MarkedUp;
            }

            return View(feedbackProject);
        }
开发者ID:phouse512,项目名称:innovation-days,代码行数:29,代码来源:FeedbackController.cs


示例9: FromMarkdown

 public static string FromMarkdown(this HtmlHelper helper, string markdown)
 {
     var md = new MarkdownDeep.Markdown();
     md.SafeMode = true;
     md.ExtraMode = true;
     return md.Transform(markdown);
 }
开发者ID:iloabn,项目名称:swetugg-web,代码行数:7,代码来源:MarkdownHelpers.cs


示例10: SetUp

 public void SetUp()
 {
     markdown = new MarkdownDeep.Markdown();
     message1 = new MessageViewModel { AuthorName = "Dianne", ID = 1, RoomID = 12345, Text = "Test!" };
     mockRoomViewModelReader = new Mock<IRoomViewModelReader>();
     var roomMessages = new[] { message1 };
     mockRoomViewModelReader.Setup(reader => reader.GetRoomMessages(It.IsAny<int>())).Returns(roomMessages);
 }
开发者ID:shanekm,项目名称:AdaptiveCodeViaCSharp,代码行数:8,代码来源:MarkdownTests.cs


示例11: ParseMarkdown

        private static string ParseMarkdown(string markdown)
        {
            var md = new MarkdownDeep.Markdown();
            md.ExtraMode = true;
            md.SafeMode = false;

            return md.Transform(markdown);
        }
开发者ID:abinabrahamanchery,项目名称:mixerp,代码行数:8,代码来源:Release.cs


示例12: MarkdownTransform

        public static string MarkdownTransform(this HtmlHelper html, string paramToTransform)
        {
            var markdown = new MarkdownDeep.Markdown();
            markdown.SafeMode = false;
            markdown.ExtraMode = true;

            return markdown.Transform(paramToTransform);
        }
开发者ID:pavlove,项目名称:Blog,代码行数:8,代码来源:MarkdownDeepHelpers.cs


示例13: GetHtmlFromMarkdown

        public static string GetHtmlFromMarkdown(string markdownText)
        {
            var md = new MarkdownDeep.Markdown();
            md.ExtraMode = true;
            md.SafeMode = false;

            return md.Transform(markdownText);
        }
开发者ID:ramhog69,项目名称:OmahaMTG.Website,代码行数:8,代码来源:MarkdownService.cs


示例14: FormatMessage

        public static string FormatMessage(String originalMessage)
        {
            MarkdownDeep.Markdown m = new MarkdownDeep.Markdown();

            m.ExtraMode = true;
            m.SafeMode = true;

            return m.Transform(originalMessage);
        }
开发者ID:G-Octav,项目名称:whoaverse,代码行数:9,代码来源:Formatting.cs


示例15: MarkdownConverter

 public MarkdownConverter()
 {
     _markdown = new MarkdownDeep.Markdown
     {
         ExtraMode = true,
         HtmlClassTitledImages = "Figure",
         FormatCodeBlock = FormatCodeBlock,
     };
 }
开发者ID:encel,项目名称:Encel,代码行数:9,代码来源:MarkdownConverter.cs


示例16: GetPagesFromCache

 public static List<PostEntity> GetPagesFromCache(this ICacheService cacheService, IPost postRepository, string keyName, bool isMarkdown)
 {
     var markdown = new MarkdownDeep.Markdown{ ExtraMode = true };
     var pages = cacheService.Get(keyName, () => postRepository.GetPages());
     if (isMarkdown)
     {
         pages.ForEach(p => p.PostContent = markdown.Transform(p.PostContent));
     }
     return pages;
 }
开发者ID:rinckd,项目名称:sblog.net,代码行数:10,代码来源:CacheServiceFluentExtensions.cs


示例17: Markdown

        public ActionResult Markdown()
        {
            var md = new MarkdownDeep.Markdown();
            md.SafeMode = true;
            md.ExtraMode = true;

            // Transform the content into HTML and pass to the view
            ViewData["content"] = md.Transform(m_Content);
            return View();
        }
开发者ID:RayKwon,项目名称:MyLab,代码行数:10,代码来源:HomeController.cs


示例18: CreateElement

 protected override XElement CreateElement(CmsContext context, CmsPart part)
 {
     var md = new MarkdownDeep.Markdown
     {
         ExtraMode = true,
         SafeMode = false,
         NewWindowForExternalLinks = true,
         FormatCodeBlock = (markdown, s) => FormatCodeBlock(context, markdown, s)
     };
     return Parse(md.Transform(part.Value));
 }
开发者ID:Steinerd,项目名称:MicroCms,代码行数:11,代码来源:MarkdownCmsRenderService.cs


示例19: Index

        public ActionResult Index()
        {
            // View the user editable content

            // Create and setup Markdown translator
            var md = new MarkdownDeep.Markdown { SafeMode = true, ExtraMode = true };

            // Transform the content and pass to the view
            ViewBag.Content = md.Transform(m_Content);
            return View();
        }
开发者ID:wwwlicious,项目名称:markdowndeep,代码行数:11,代码来源:MarkdownDeepController.cs


示例20: markdown_Transform

        public static string markdown_Transform(this string markdown)
        {
            var md = new MarkdownDeep.Markdown
                         {
                             SafeMode       = SafeMode,       // was false in the MarkdownDeep demo app
                             ExtraMode      = ExtraMode,          // was true, was creating some probs with HTML conversion (too agreesive on spaces)
                             AutoHeadingIDs = true,
                             MarkdownInHtml = true,
                             NewWindowForExternalLinks = true,

                         };
            return md.Transform(markdown);
        }
开发者ID:TeamMentor,项目名称:Dev,代码行数:13,代码来源:MarkdownDeep_ExtensionMethods.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MarkdownSharp.Markdown类代码示例发布时间:2022-05-24
下一篇:
C# Mark类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap