├── docs
├── images
│ ├── Code.png
│ ├── LPFlow.png
│ ├── Diagram.png
│ ├── favicon.ico
│ ├── favicon.jpg
│ ├── FrontMatter.png
│ ├── GitHubPages.png
│ ├── Navigation.png
│ ├── jumbotron.jpg
│ ├── DocsForLiterateLib.png
│ └── LiterateLibInVSCode.png
├── syntax-highlight
│ ├── syntax.js
│ ├── syntax-base.less
│ ├── monokai.less
│ ├── son-of-obsidian.less
│ ├── coding-horror.less
│ ├── solarized-light.less
│ ├── monokai.min.css
│ ├── son-of-obsidian.min.css
│ ├── coding-horror.min.css
│ ├── solarized-light.min.css
│ ├── monokai.css
│ ├── son-of-obsidian.css
│ ├── solarized-light.css
│ └── coding-horror.css
├── font-awesome
│ └── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ └── fontawesome-webfont.woff2
├── bootstrap
│ └── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
├── css
│ ├── landingpage.css
│ ├── plain.min.css
│ ├── book.min.css
│ ├── modern.min.css
│ ├── plain.css
│ ├── book.css
│ └── modern.css
├── sidebar
│ ├── sidebar.min.css
│ ├── sidebar.css
│ ├── sidebar.less
│ └── sidebar.js
└── mermaid
│ ├── mermaid.css
│ └── mermaid.dark.css
├── DefaultTheme
├── default_assets
│ ├── syntax-highlight
│ │ ├── syntax.js
│ │ ├── syntax-base.less
│ │ ├── monokai.less
│ │ ├── son-of-obsidian.less
│ │ ├── solarized-light.less
│ │ ├── coding-horror.less
│ │ ├── monokai.min.css
│ │ ├── son-of-obsidian.min.css
│ │ ├── coding-horror.min.css
│ │ ├── solarized-light.min.css
│ │ ├── monokai.css
│ │ ├── son-of-obsidian.css
│ │ ├── coding-horror.css
│ │ └── solarized-light.css
│ ├── font-awesome
│ │ └── fonts
│ │ │ ├── FontAwesome.otf
│ │ │ ├── fontawesome-webfont.eot
│ │ │ ├── fontawesome-webfont.ttf
│ │ │ ├── fontawesome-webfont.woff
│ │ │ └── fontawesome-webfont.woff2
│ ├── bootstrap
│ │ └── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ └── glyphicons-halflings-regular.woff2
│ ├── css
│ │ ├── landingpage.css
│ │ ├── plain.min.css
│ │ ├── book.min.css
│ │ ├── modern.min.css
│ │ ├── plain.css
│ │ ├── book.css
│ │ ├── plain.less
│ │ ├── modern.css
│ │ ├── book.less
│ │ └── modern.less
│ ├── sidebar
│ │ ├── sidebar.min.css
│ │ ├── sidebar.css
│ │ ├── sidebar.less
│ │ └── sidebar.js
│ └── mermaid
│ │ ├── mermaid.css
│ │ └── mermaid.dark.css
├── compilerconfig.json
├── IPageTemplate.cs
├── DefaultPageTemplate.cs
├── LandingPageTemplate.cs
├── include
│ ├── LandingScripts.tt
│ ├── LandingStyles.tt
│ ├── Footer.tt
│ ├── LandingHead.tt
│ ├── Head.tt
│ ├── SideBar.tt
│ ├── Styles.tt
│ ├── Toc.tt
│ ├── Scripts.tt
│ ├── Pager.tt
│ └── NavBar.tt
├── DefaultTheme.cs
├── LandingPage.tt
├── compilerconfig.json.defaults
├── DefaultPage.tt
└── DefaultTheme.csproj
├── LiterateCS.Theme
├── LiterateCS.Theme.csproj
├── Theme.cs
├── LiterateException.cs
├── DirHelpers.cs
├── Toc.cs
└── PageParams.cs
├── .gitignore
├── defaults.yml
├── License.md
├── .vscode
├── launch.json
└── tasks.json
├── TestPackage.ps1
├── LiterateCS
├── LiterateCS.csproj
├── MdWeaver.cs
├── Program.cs
├── Macro.cs
├── HtmlWeaver.cs
├── TocManager.cs
├── BlockList.cs
└── SplitPath.cs
├── Installation.md
├── TableOfContents.md
├── TOC.yml
├── LiterateCS.sln
├── README.md
└── index.md
/docs/images/Code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/Code.png
--------------------------------------------------------------------------------
/docs/images/LPFlow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/LPFlow.png
--------------------------------------------------------------------------------
/docs/images/Diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/Diagram.png
--------------------------------------------------------------------------------
/docs/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/favicon.ico
--------------------------------------------------------------------------------
/docs/images/favicon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/favicon.jpg
--------------------------------------------------------------------------------
/docs/images/FrontMatter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/FrontMatter.png
--------------------------------------------------------------------------------
/docs/images/GitHubPages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/GitHubPages.png
--------------------------------------------------------------------------------
/docs/images/Navigation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/Navigation.png
--------------------------------------------------------------------------------
/docs/images/jumbotron.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/jumbotron.jpg
--------------------------------------------------------------------------------
/docs/syntax-highlight/syntax.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function () {
2 | $('[data-toggle="tooltip"]').tooltip();
3 | });
--------------------------------------------------------------------------------
/docs/images/DocsForLiterateLib.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/DocsForLiterateLib.png
--------------------------------------------------------------------------------
/docs/images/LiterateLibInVSCode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/images/LiterateLibInVSCode.png
--------------------------------------------------------------------------------
/docs/font-awesome/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/font-awesome/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/syntax-highlight/syntax.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function () {
2 | $('[data-toggle="tooltip"]').tooltip();
3 | });
--------------------------------------------------------------------------------
/docs/font-awesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/font-awesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/docs/font-awesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/font-awesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/docs/font-awesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/font-awesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/docs/font-awesome/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/font-awesome/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/docs/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/bootstrap/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/docs/bootstrap/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/DefaultTheme/compilerconfig.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "outputFile": "default_assets/sidebar/sidebar.css",
4 | "inputFile": "default_assets/sidebar/sidebar.less"
5 | }
6 | ]
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/font-awesome/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/font-awesome/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/font-awesome/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/johtela/LiterateCS/HEAD/DefaultTheme/default_assets/bootstrap/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/DefaultTheme/IPageTemplate.cs:
--------------------------------------------------------------------------------
1 | namespace DefaultTheme
2 | {
3 | using LiterateCS.Theme;
4 |
5 | interface IPageTemplate
6 | {
7 | PageParams Params { get; set; }
8 | string Render ();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/DefaultTheme/DefaultPageTemplate.cs:
--------------------------------------------------------------------------------
1 | namespace DefaultTheme
2 | {
3 | using LiterateCS.Theme;
4 |
5 | public partial class DefaultPage : IPageTemplate
6 | {
7 | public PageParams Params { get; set; }
8 |
9 | public string Render ()
10 | {
11 | return TransformText ();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/DefaultTheme/LandingPageTemplate.cs:
--------------------------------------------------------------------------------
1 | namespace DefaultTheme
2 | {
3 | using LiterateCS.Theme;
4 |
5 | public partial class LandingPage : IPageTemplate
6 | {
7 | public PageParams Params { get; set; }
8 |
9 | public string Render ()
10 | {
11 | return TransformText ();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/LiterateCS.Theme/LiterateCS.Theme.csproj:
--------------------------------------------------------------------------------
1 |





";
47 | private const string _htmlCodeFooter = @"";
48 | /*
49 | The string builder is used to construct contents of a block. It is discarded after
50 | its content is extracted.
51 | */
52 | internal StringBuilder _builder;
53 | /*
54 | ### Creating a Block
55 | Blocks are constructed dynamically as the source file is parsed. When creating a new
56 | block only the kind of the block and the output format needs to be specified. Based
57 | on those the constructor initializes a new block and inserts a correct header to it.
58 |
59 | In markdown output whitespace is a bit more important than in HTML. That is why
60 | we sometimes need to add additional line breaks to the output.
61 | */
62 | public BlockList (BlockKind kind, OutputFormat format)
63 | {
64 | Kind = kind;
65 | _builder = new StringBuilder ();
66 | }
67 | /*
68 | Create a new markdown block.
69 | */
70 | public BlockList (string contents)
71 | {
72 | Kind = BlockKind.Markdown;
73 | Contents = contents;
74 | }
75 | /*
76 | Cloning a single block.
77 | */
78 | public BlockList (BlockList block)
79 | {
80 | Kind = block.Kind;
81 | Contents = block.Contents;
82 | }
83 | /*
84 | ### Closing a Block
85 | After a block is filled with its content it can be closed. Closing involves
86 | adding the correct header and footer to the output. Code blocks are trimmed
87 | before these are added. If they do not contain any text after trimming, then we
88 | don't add the header and footer at all. After the `StringBuilder` object has
89 | converted the contents to string, it can be disposed by assigning `null` to the
90 | field.
91 | */
92 | public void Close (OutputFormat format)
93 | {
94 | if (Kind == BlockKind.Code)
95 | {
96 | TrimStart ();
97 | TrimEnd ();
98 | if (_builder.Length > 0)
99 | {
100 | _builder.Insert (0, format == OutputFormat.html ?
101 | _htmlCodeHeader :
102 | _mdCodeHeader + Environment.NewLine);
103 | _builder.Append (Environment.NewLine);
104 | _builder.AppendLine (format == OutputFormat.html ?
105 | _htmlCodeFooter :
106 | _mdCodeFooter);
107 | }
108 | }
109 | Contents = _builder.ToString ();
110 | _builder = null;
111 | }
112 | /*
113 | Code blocks are trimmed to get rid of extra white space at the beginning and
114 | end of them. This makes the verbatim output more compact and readable. The
115 | following methods trim all whitespace from the beginning and from the end
116 | of the block. Note that we don't remove the whitespace before the first
117 | non-empty line, so indentation is preserved.
118 | */
119 | private void TrimStart ()
120 | {
121 | while (RemoveFirstEmptyLine ());
122 | }
123 |
124 | private void TrimEnd ()
125 | {
126 | var last = _builder.Length - 1;
127 | var i = last;
128 | while (i >= 0 && char.IsWhiteSpace (_builder[i]))
129 | i--;
130 | if (i < last)
131 | _builder.Remove (i + 1, last - i);
132 | }
133 | /*
134 | The method below removes the first line of a block, if it contains just
135 | whitespace. It handles both Windows and Unix style line delimiters. The
136 | method returns true, if it removed a line, and false if it did not.
137 | */
138 | private bool RemoveFirstEmptyLine ()
139 | {
140 | var i = 0;
141 | while (i < _builder.Length && char.IsWhiteSpace (_builder[i]) &&
142 | !_builder[i].In ('\r', '\n'))
143 | i++;
144 | if (i == _builder.Length || !_builder[i].In ('\r', '\n'))
145 | return false;
146 | _builder.Remove (0, i + 1);
147 | return true;
148 | }
149 | /*
150 | ### IEnumerable Implementation
151 | Iterator is used to implement `IEnumerable