Skip to content

Commit 0e74ea5

Browse files
authored
Merge branch 'main' into feature/code-callouts
2 parents d0a5982 + 42cc222 commit 0e74ea5

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Through the `serve` command you can continuously and partially compile your docu
6363

6464
```bash
6565
docker run -v "./.git:/app/.git" -v "./docs:/app/docs" -v "./.artifacts:/app/.artifacts" \
66-
--expose 8080 ghcr.io/elastic/docs-builder:edge serve
66+
-p 8080:8080 ghcr.io/elastic/docs-builder:edge serve
6767
```
6868

6969
Each page is compiled on demand as you browse http://localhost:8080 and is never cached so changes to files and
@@ -148,4 +148,4 @@ The resulting binary `./.artifacts/publish/docs-builder` will run on machines wi
148148
To test performance it's best to build the binary and run outside of docker:
149149

150150
For refence here's the `markitpy-doc` docset (50k markdown files) currently takes `14s` vs `several minutes` compared to
151-
existing surveyed tools
151+
existing surveyed tools

src/Elastic.Markdown/IO/ConfigurationFile.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public ConfigurationFile(IFileInfo sourceFile, IDirectoryInfo rootPath, BuildCon
4949
yaml.Load(textReader);
5050

5151
if (yaml.Documents.Count == 0)
52+
{
5253
context.EmitWarning(sourceFile, "empty configuration");
54+
return;
55+
}
5356

5457
// Examine the stream
5558
var mapping = (YamlMappingNode)yaml.Documents[0].RootNode;

src/Elastic.Markdown/Myst/Directives/AdmonitionBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public string Title
3434
public override void FinalizeAndValidate(ParserContext context)
3535
{
3636
CrossReferenceName = Properties.GetValueOrDefault("name");
37-
DropdownOpen = PropBool("open");
37+
DropdownOpen = TryPropBool("open");
3838
if (DropdownOpen.HasValue)
3939
Classes = "dropdown";
4040
}

src/Elastic.Markdown/Myst/Directives/DirectiveBlock.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ protected bool PropBool(params string[] keys)
106106
return bool.TryParse(value, out var result) && result;
107107
}
108108

109+
protected bool? TryPropBool(params string[] keys)
110+
{
111+
var value = Prop(keys);
112+
if (string.IsNullOrEmpty(value))
113+
return keys.Any(k => Properties.ContainsKey(k)) ? true : null;
114+
115+
return bool.TryParse(value, out var result) ? result : null;
116+
}
117+
118+
109119
protected string? Prop(params string[] keys)
110120
{
111121
foreach (var key in keys)

tests/Elastic.Markdown.Tests/OutputDirectoryTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public async Task CreatesDefaultOutputDirectory()
1818
var logger = new TestLoggerFactory(output);
1919
var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
2020
{
21+
{ "docs/source/docset.yml", new MockFileData("") },
2122
{ "docs/source/index.md", new MockFileData("test") }
2223
}, new MockFileSystemOptions
2324
{

0 commit comments

Comments
 (0)