Skip to content

Commit 0512fe0

Browse files
committed
always split dib cells on markdown language
1 parent b0a1602 commit 0512fe0

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/Microsoft.DotNet.Interactive.Documents.Tests/CodeSubmissionFormatTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class CodeSubmissionFormatTests : DocumentFormatTestsBase
1111
{
1212
public InteractiveDocument ParseDib(string content)
1313
{
14-
return CodeSubmission.Parse( content,"csharp", KernelLanguageAliases);
14+
return CodeSubmission.Parse(content, "csharp", KernelLanguageAliases);
1515
}
1616

1717
public string SerializeDib(InteractiveDocument interactive, string newLine)
@@ -193,11 +193,13 @@ public void empty_lines_are_removed_between_cells()
193193
});
194194
}
195195

196-
[Fact]
197-
public void markdown_cells_can_be_parsed_even_though_its_not_a_kernel_language()
196+
[Theory]
197+
[InlineData("markdown")]
198+
[InlineData("md")]
199+
public void markdown_cells_can_be_parsed_even_though_its_not_a_kernel_language(string cellLanguage)
198200
{
199-
var notebook = ParseDib(@"
200-
#!markdown
201+
var notebook = ParseDib($@"
202+
#!{cellLanguage}
201203
202204
This is `markdown`.
203205
");

src/Microsoft.DotNet.Interactive.Documents.Tests/DocumentFormatTestsBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ protected DocumentFormatTestsBase()
1717
new("csharp", new[] { "cs", "C#", "c#" }),
1818
new("fsharp", new[] { "fs", "F#", "f#" }),
1919
new("pwsh", new[] { "powershell" }),
20-
new("markdown", new[] { "md" }),
2120
};
2221
}
2322
}

src/Microsoft.DotNet.Interactive.Documents/CodeSubmission.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ void AddElement()
5757
}
5858
}
5959

60-
var mapOfKernelNamesByAlias = kernelNames.ToMapOfKernelNamesByAlias();
60+
var splittingKernelNames = kernelNames.ToList();
61+
splittingKernelNames.Add(new KernelName("markdown", new[] { "md" })); // not a kernel language, but still a valid cell splitter
62+
var mapOfKernelNamesByAlias = splittingKernelNames.ToMapOfKernelNamesByAlias();
6163

6264
foreach (var line in lines)
6365
{

0 commit comments

Comments
 (0)