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


C# MarkdownDeep.Markdown类代码示例

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


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


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