diff --git a/src/Microsoft.DotNet.Interactive.Documents.Tests/CodeSubmissionFormatTests.cs b/src/Microsoft.DotNet.Interactive.Documents.Tests/CodeSubmissionFormatTests.cs index a704116bc9..6f766c7a26 100644 --- a/src/Microsoft.DotNet.Interactive.Documents.Tests/CodeSubmissionFormatTests.cs +++ b/src/Microsoft.DotNet.Interactive.Documents.Tests/CodeSubmissionFormatTests.cs @@ -11,7 +11,7 @@ public class CodeSubmissionFormatTests : DocumentFormatTestsBase { public InteractiveDocument ParseDib(string content) { - return CodeSubmission.Parse( content,"csharp", KernelLanguageAliases); + return CodeSubmission.Parse(content, "csharp", KernelLanguageAliases); } public string SerializeDib(InteractiveDocument interactive, string newLine) @@ -193,11 +193,13 @@ public void empty_lines_are_removed_between_cells() }); } - [Fact] - public void markdown_cells_can_be_parsed_even_though_its_not_a_kernel_language() + [Theory] + [InlineData("markdown")] + [InlineData("md")] + public void markdown_cells_can_be_parsed_even_though_its_not_a_kernel_language(string cellLanguage) { - var notebook = ParseDib(@" -#!markdown + var notebook = ParseDib($@" +#!{cellLanguage} This is `markdown`. "); diff --git a/src/Microsoft.DotNet.Interactive.Documents.Tests/DocumentFormatTestsBase.cs b/src/Microsoft.DotNet.Interactive.Documents.Tests/DocumentFormatTestsBase.cs index 4e4cf66ba7..0e756dd7a1 100644 --- a/src/Microsoft.DotNet.Interactive.Documents.Tests/DocumentFormatTestsBase.cs +++ b/src/Microsoft.DotNet.Interactive.Documents.Tests/DocumentFormatTestsBase.cs @@ -17,7 +17,6 @@ protected DocumentFormatTestsBase() new("csharp", new[] { "cs", "C#", "c#" }), new("fsharp", new[] { "fs", "F#", "f#" }), new("pwsh", new[] { "powershell" }), - new("markdown", new[] { "md" }), }; } } diff --git a/src/Microsoft.DotNet.Interactive.Documents/CodeSubmission.cs b/src/Microsoft.DotNet.Interactive.Documents/CodeSubmission.cs index 178a571c6c..c2be24cac1 100644 --- a/src/Microsoft.DotNet.Interactive.Documents/CodeSubmission.cs +++ b/src/Microsoft.DotNet.Interactive.Documents/CodeSubmission.cs @@ -57,7 +57,9 @@ void AddElement() } } - var mapOfKernelNamesByAlias = kernelNames.ToMapOfKernelNamesByAlias(); + var splittingKernelNames = kernelNames.ToList(); + splittingKernelNames.Add(new KernelName("markdown", new[] { "md" })); // not a kernel language, but still a valid cell splitter + var mapOfKernelNamesByAlias = splittingKernelNames.ToMapOfKernelNamesByAlias(); foreach (var line in lines) {