Ejemplo n.º 1
0
        private static async Task <string> GetPlainTextArticle(string articlePath)
        {
            var markdownContent = await File.ReadAllTextAsync(articlePath);

            var plainTextContent     = MarkdigConverter.ConvertToPlainText(markdownContent);
            var plainTextArticlePath = Path.ChangeExtension(articlePath, "txt");
            await File.WriteAllTextAsync(plainTextArticlePath, plainTextContent);

            return(plainTextArticlePath);
        }
Ejemplo n.º 2
0
        public void ShouldConvertToPlainText()
        {
            // Arrange
            var markdown = @"2nd paragraph. *Italic*, **bold**, and `monospace`.";
            var expected = "2nd paragraph. Italic, bold, and monospace.";

            // Act
            var plainText = MarkdigConverter.ConvertToPlainText(markdown);

            // Assert
            Check.That(plainText).IsNotNull();
            Check.That(plainText == expected);
        }