Ejemplo n.º 1
0
        /// <summary>
        /// Reading from a file, and rendering HTML to a string
        /// </summary>
        public static void ReadFromFileRenderToString()
        {
            var cm = new CommonMark();

            using (var reader = File.OpenText("Example.md"))
            {
                var html = cm.RenderAsHtml(reader);
            }
        }
Ejemplo n.º 2
0
        public void UnderscoreWithinEmphasis()
        {
            // See https://github.com/jgm/stmd/issues/51 for additional info
            // The rule is that inlines are processed left-to-right

            // Arrange
            var commonMark = Helpers.Normalize("*_*_");
            var expected = Helpers.Normalize("<p><em>_</em>_</p>");
            Helpers.LogValue("CommonMark", commonMark);
            Helpers.LogValue("Expected", expected);

            // Act
            var actual = _cm.RenderAsHtml(commonMark);

            // Assert
            Helpers.LogValue("Actual", actual);
            Assert.AreEqual(Helpers.Tidy(expected), Helpers.Tidy(actual));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reading from a file, and rendering HTML to another file
        /// </summary>
        public static void ReadFromFileRenderToFile()
        {
            var cm = new CommonMark();

            using (var reader = File.OpenText("Example.md"))
                using (var writer = File.CreateText("ReadFromFileRenderToFile.html"))
                {
                    cm.RenderAsHtml(reader, writer);
                }
        }