Skip to content

Commit

Permalink
Merge pull request #13 from BenRStutzman/feature/add-url-include
Browse files Browse the repository at this point in the history
Optionally use a URL include instead of file include
  • Loading branch information
yanjustino authored May 25, 2021
2 parents b81e08f + 14761b5 commit 5d25145
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/C4Sharp/Models/Plantuml/PlantumlDiagram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ namespace C4Sharp.Models.Plantuml
/// </summary>
public static class PlantumlDiagram
{
const string standardLibraryBaseUrl = "https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master";

/// <summary>
/// Create PUML content from Diagram
/// </summary>
/// <param name="diagram"></param>
/// <returns></returns>
public static string ToPumlString(this Diagram diagram)
public static string ToPumlString(this Diagram diagram, bool useUrlInclude = false)
{
var path = Path.Join(C4Directory.ResourcesFolderName, $"{diagram.Name}.puml");
var pumlFileName = $"{diagram.Name}.puml";
var path = useUrlInclude ? $"{standardLibraryBaseUrl}/{pumlFileName}"
: Path.Join(C4Directory.ResourcesFolderName, pumlFileName);

var stream = new StringBuilder();
stream.AppendLine($"@startuml {diagram.Slug()}");
Expand Down

0 comments on commit 5d25145

Please sign in to comment.