diff --git a/src/DocNet/Config.cs b/src/DocNet/Config.cs index 5d2dc5a..669fe6a 100644 --- a/src/DocNet/Config.cs +++ b/src/DocNet/Config.cs @@ -64,7 +64,10 @@ namespace Docnet Console.WriteLine("[ERROR] Page template '{0}' is empty.", _configData.PageTemplate); return false; } - return true; + // Set default extension + string defaultExtension = _configData.DefaultExtension; + DefaultExtension = string.IsNullOrWhiteSpace(defaultExtension) ? "htm" : defaultExtension; + return true; } @@ -269,7 +272,12 @@ namespace Docnet } return rawFolderNames.HasValues ? rawFolderNames.Values().ToList() : new List(); } - } - #endregion - } + } + + /// + /// File extension to be used for the generated HTML files. Defaults to 'htm' + /// + public static string DefaultExtension = "htm"; + #endregion + } } \ No newline at end of file diff --git a/src/DocNet/SimpleNavigationElement.cs b/src/DocNet/SimpleNavigationElement.cs index 2de247b..5b38f7e 100644 --- a/src/DocNet/SimpleNavigationElement.cs +++ b/src/DocNet/SimpleNavigationElement.cs @@ -210,7 +210,7 @@ namespace Docnet _targetURLForHTML = (this.Value ?? string.Empty); if(_targetURLForHTML.ToLowerInvariant().EndsWith(".md")) { - _targetURLForHTML = _targetURLForHTML.Substring(0, _targetURLForHTML.Length-3) + ".htm"; + _targetURLForHTML = String.Format("{0}.{1}", _targetURLForHTML.Substring(0, _targetURLForHTML.Length-3), Config.DefaultExtension); } _targetURLForHTML = _targetURLForHTML.Replace("\\", "/"); }