├── .github
└── workflows
│ └── dotnet-core.yml
├── .gitignore
├── LICENSE
├── README.md
├── docs
├── SiteConfig.yml
├── source
│ ├── Installing
│ │ └── index.md
│ ├── apidocs
│ │ └── index.md
│ ├── assets
│ │ └── main.css
│ ├── cli
│ │ └── index.md
│ ├── index.md
│ ├── menu.md
│ └── templates
│ │ └── index.md
└── templates
│ ├── Default.cshtml
│ ├── SiteFrame.cshtml
│ └── menu.cshtml
└── toolsrc
├── Chloroplast.Core
├── Chloroplast.Core.csproj
├── ChloroplastException.cs
├── Config.cs
├── Config
│ └── SiteConfigSource.cs
├── Content
│ ├── ContentArea.cs
│ ├── DiskFile.cs
│ ├── Header.cs
│ └── IFile.cs
├── ContentNode.cs
├── Extensions
│ ├── CollectionExtensions.cs
│ ├── PathExtensions.cs
│ └── SiteConfigurationExtensions.cs
├── Loaders
│ ├── EcmaXmlExtensions.cs
│ ├── EcmaXmlLoader.cs
│ └── monodoc-ecma.cs
└── Rendering
│ ├── ChloroplastTemplateBase.cs
│ ├── ContentRenderer.cs
│ ├── EcmaXmlRenderer.cs
│ ├── MarkdownRenderer.cs
│ ├── RazorRenderer.cs
│ └── YamlRenderer.cs
├── Chloroplast.Test
├── Chloroplast.Test.csproj
├── EcmaXmlTests.cs
├── MarkdownTests.cs
├── PathTests.cs
├── RazorTests.cs
├── TreeTests.cs
└── YamlTests.cs
├── Chloroplast.Tool
├── Chloroplast.Tool.csproj
├── Commands
│ ├── FullBuildCommand.cs
│ ├── HostCommand.cs
│ ├── ICliCommand.cs
│ ├── NewCommand.cs
│ └── WatchCommand.cs
├── Constants.cs
└── Program.cs
├── Chloroplast.Web
├── Chloroplast.Web.csproj
├── Controllers
│ └── ContentController.cs
├── Program.cs
├── Startup.cs
├── appsettings.Development.json
└── appsettings.json
├── Chloroplast.sln
└── index.md
/.github/workflows/dotnet-core.yml:
--------------------------------------------------------------------------------
1 | name: .NET Core - build
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | env:
10 | DOTNET_CLI_TELEMETRY_OPTOUT: 1
11 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
12 |
13 | jobs:
14 | build:
15 |
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - uses: actions/checkout@v2
20 | - name: Setup .NET Core
21 | uses: actions/setup-dotnet@v1
22 | with:
23 | dotnet-version: 3.1.x
24 | - name: Install dependencies
25 | run: dotnet restore toolsrc
26 | - name: Build
27 | run: dotnet build --configuration Release --no-restore toolsrc
28 | - name: Test
29 | run: dotnet test --no-restore --verbosity normal toolsrc
30 | - name: Pack
31 | run: dotnet pack toolsrc/Chloroplast.Core/
32 | - name: Pack Tool
33 | run: dotnet pack toolsrc/Chloroplast.Tool/
34 | - name: Upload a Build Artifact
35 | uses: actions/upload-artifact@v2.1.3
36 | with:
37 | name: chloroplast_tool
38 | path: toolsrc/Chloroplast.Tool/nupkg/*.nupkg
39 | - name: Add private GitHub registry to NuGet
40 | if: github.ref == 'refs/heads/main'
41 | run: dotnet nuget add source https://nuget.pkg.github.com/WildernessLabs/index.json --name "github" --username WildernessLabs --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
42 | env:
43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 | - name: Tool Core generated package to GitHub registry
45 | if: github.ref == 'refs/heads/main'
46 | run: dotnet nuget push ./toolsrc/Chloroplast.Core/nupkg/*.nupkg --source "github" --skip-duplicate --no-symbols true
47 | env:
48 | DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
49 | - name: Tool Push generated package to GitHub registry
50 | if: github.ref == 'refs/heads/main'
51 | run: dotnet nuget push ./toolsrc/Chloroplast.Tool/nupkg/*.nupkg --source "github" --skip-duplicate --no-symbols true
52 | env:
53 | DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
54 | - name: Tool Push generated package to nuget.org registry
55 | if: github.ref == 'refs/heads/main'
56 | run: dotnet nuget push ./toolsrc/Chloroplast.Tool/nupkg/*.nupkg --source "nuget.org" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols true
57 | env:
58 | DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
59 |
60 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # Chloroplast stuff
7 | Temp
8 | out
9 |
10 | # User-specific files
11 | *.rsuser
12 | *.suo
13 | *.user
14 | *.userosscache
15 | *.sln.docstates
16 | launchSettings.json
17 |
18 | # User-specific files (MonoDevelop/Xamarin Studio)
19 | *.userprefs
20 |
21 | # Mono auto generated files
22 | mono_crash.*
23 |
24 | # Build results
25 | [Dd]ebug/
26 | [Dd]ebugPublic/
27 | [Rr]elease/
28 | [Rr]eleases/
29 | x64/
30 | x86/
31 | [Aa][Rr][Mm]/
32 | [Aa][Rr][Mm]64/
33 | bld/
34 | [Bb]in/
35 | [Oo]bj/
36 | [Ll]og/
37 | [Ll]ogs/
38 |
39 | # Visual Studio 2015/2017 cache/options directory
40 | .vs/
41 | # Uncomment if you have tasks that create the project's static files in wwwroot
42 | #wwwroot/
43 |
44 | # Visual Studio 2017 auto generated files
45 | Generated\ Files/
46 |
47 | # MSTest test Results
48 | [Tt]est[Rr]esult*/
49 | [Bb]uild[Ll]og.*
50 |
51 | # NUnit
52 | *.VisualState.xml
53 | TestResult.xml
54 | nunit-*.xml
55 |
56 | # Build Results of an ATL Project
57 | [Dd]ebugPS/
58 | [Rr]eleasePS/
59 | dlldata.c
60 |
61 | # Benchmark Results
62 | BenchmarkDotNet.Artifacts/
63 |
64 | # .NET Core
65 | project.lock.json
66 | project.fragment.lock.json
67 | artifacts/
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Visual Studio code coverage results
146 | *.coverage
147 | *.coveragexml
148 |
149 | # NCrunch
150 | _NCrunch_*
151 | .*crunch*.local.xml
152 | nCrunchTemp_*
153 |
154 | # MightyMoose
155 | *.mm.*
156 | AutoTest.Net/
157 |
158 | # Web workbench (sass)
159 | .sass-cache/
160 |
161 | # Installshield output folder
162 | [Ee]xpress/
163 |
164 | # DocProject is a documentation generator add-in
165 | DocProject/buildhelp/
166 | DocProject/Help/*.HxT
167 | DocProject/Help/*.HxC
168 | DocProject/Help/*.hhc
169 | DocProject/Help/*.hhk
170 | DocProject/Help/*.hhp
171 | DocProject/Help/Html2
172 | DocProject/Help/html
173 |
174 | # Click-Once directory
175 | publish/
176 |
177 | # Publish Web Output
178 | *.[Pp]ublish.xml
179 | *.azurePubxml
180 | # Note: Comment the next line if you want to checkin your web deploy settings,
181 | # but database connection strings (with potential passwords) will be unencrypted
182 | *.pubxml
183 | *.publishproj
184 |
185 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
186 | # checkin your Azure Web App publish settings, but sensitive information contained
187 | # in these scripts will be unencrypted
188 | PublishScripts/
189 |
190 | # NuGet Packages
191 | *.nupkg
192 | # NuGet Symbol Packages
193 | *.snupkg
194 | # The packages folder can be ignored because of Package Restore
195 | **/[Pp]ackages/*
196 | # except build/, which is used as an MSBuild target.
197 | !**/[Pp]ackages/build/
198 | # Uncomment if necessary however generally it will be regenerated when needed
199 | #!**/[Pp]ackages/repositories.config
200 | # NuGet v3's project.json files produces more ignorable files
201 | *.nuget.props
202 | *.nuget.targets
203 |
204 | # Microsoft Azure Build Output
205 | csx/
206 | *.build.csdef
207 |
208 | # Microsoft Azure Emulator
209 | ecf/
210 | rcf/
211 |
212 | # Windows Store app package directories and files
213 | AppPackages/
214 | BundleArtifacts/
215 | Package.StoreAssociation.xml
216 | _pkginfo.txt
217 | *.appx
218 | *.appxbundle
219 | *.appxupload
220 |
221 | # Visual Studio cache files
222 | # files ending in .cache can be ignored
223 | *.[Cc]ache
224 | # but keep track of directories ending in .cache
225 | !?*.[Cc]ache/
226 |
227 | # Others
228 | ClientBin/
229 | ~$*
230 | *~
231 | *.dbmdl
232 | *.dbproj.schemaview
233 | *.jfm
234 | *.pfx
235 | *.publishsettings
236 | orleans.codegen.cs
237 |
238 | # Including strong name files can present a security risk
239 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
240 | #*.snk
241 |
242 | # Since there are multiple workflows, uncomment next line to ignore bower_components
243 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
244 | #bower_components/
245 |
246 | # RIA/Silverlight projects
247 | Generated_Code/
248 |
249 | # Backup & report files from converting an old project file
250 | # to a newer Visual Studio version. Backup files are not needed,
251 | # because we have git ;-)
252 | _UpgradeReport_Files/
253 | Backup*/
254 | UpgradeLog*.XML
255 | UpgradeLog*.htm
256 | ServiceFabricBackup/
257 | *.rptproj.bak
258 |
259 | # SQL Server files
260 | *.mdf
261 | *.ldf
262 | *.ndf
263 |
264 | # Business Intelligence projects
265 | *.rdl.data
266 | *.bim.layout
267 | *.bim_*.settings
268 | *.rptproj.rsuser
269 | *- [Bb]ackup.rdl
270 | *- [Bb]ackup ([0-9]).rdl
271 | *- [Bb]ackup ([0-9][0-9]).rdl
272 |
273 | # Microsoft Fakes
274 | FakesAssemblies/
275 |
276 | # GhostDoc plugin setting file
277 | *.GhostDoc.xml
278 |
279 | # Node.js Tools for Visual Studio
280 | .ntvs_analysis.dat
281 | node_modules/
282 |
283 | # Visual Studio 6 build log
284 | *.plg
285 |
286 | # Visual Studio 6 workspace options file
287 | *.opt
288 |
289 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
290 | *.vbw
291 |
292 | # Visual Studio LightSwitch build output
293 | **/*.HTMLClient/GeneratedArtifacts
294 | **/*.DesktopClient/GeneratedArtifacts
295 | **/*.DesktopClient/ModelManifest.xml
296 | **/*.Server/GeneratedArtifacts
297 | **/*.Server/ModelManifest.xml
298 | _Pvt_Extensions
299 |
300 | # Paket dependency manager
301 | .paket/paket.exe
302 | paket-files/
303 |
304 | # FAKE - F# Make
305 | .fake/
306 |
307 | # CodeRush personal settings
308 | .cr/personal
309 |
310 | # Python Tools for Visual Studio (PTVS)
311 | __pycache__/
312 | *.pyc
313 |
314 | # Cake - Uncomment if you are using it
315 | # tools/**
316 | # !tools/packages.config
317 |
318 | # Tabs Studio
319 | *.tss
320 |
321 | # Telerik's JustMock configuration file
322 | *.jmconfig
323 |
324 | # BizTalk build output
325 | *.btp.cs
326 | *.btm.cs
327 | *.odx.cs
328 | *.xsd.cs
329 |
330 | # OpenCover UI analysis results
331 | OpenCover/
332 |
333 | # Azure Stream Analytics local run output
334 | ASALocalRun/
335 |
336 | # MSBuild Binary and Structured Log
337 | *.binlog
338 |
339 | # NVidia Nsight GPU debugger configuration file
340 | *.nvuser
341 |
342 | # MFractors (Xamarin productivity tool) working folder
343 | .mfractor/
344 |
345 | # Local History for Visual Studio
346 | .localhistory/
347 |
348 | # BeatPulse healthcheck temp database
349 | healthchecksdb
350 |
351 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
352 | MigrationBackup/
353 |
354 | # Ionide (cross platform F# VS Code tools) working folder
355 | .ionide/
356 |
357 |
358 | # MacOS shit
359 | **/.DS_Store
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Chloroplast
2 | Wilderness Labs docs engine that converts and hosts Markdown and (soon) XML API docs into HTML.
3 |
4 | ## Getting Started
5 |
6 | First [Install](/docs/source/Installing/index.md) the `choloroplast.tool` dotnet tool.
7 |
8 | Then run the following commands to: create a new Chloroplast project at `targetFolder`, then build it, and run the local Chloroplast webserver to preview the docs.
9 |
10 | ```
11 | chloroplast new conceptual targetFolder
12 |
13 | cd targetFolder
14 |
15 | chloroplast build
16 | chloroplast host
17 | ```
18 |
19 | Once you're done with that, you can modify that default template, and [read the docs](/docs/).
20 |
21 | ## Host the Chloroplast docs
22 |
23 | If you want to see Chloroplast in action, you can even host the Chloroplast docs themselves.
24 |
25 | 1. Clone the Chloroplast repo.
26 |
27 | ```
28 | git clone https://github.com/WildernessLabs/Chloroplast.git
29 | cd Chloroplast
30 | ```
31 |
32 | 1. Install Chloroplast.
33 |
34 | There are [several ways to install Chloroplast](https://github.com/WildernessLabs/Chloroplast/blob/main/docs/source/Installing/index.md#package-repository). This will install it from NuGet as a global tool.
35 |
36 | ```
37 | dotnet tool install Chloroplast.Tool -g
38 | ```
39 |
40 | 1. Navigate to the Chloroplast docs.
41 |
42 | ```
43 | cd docs
44 | ```
45 |
46 | 1. Build and host the docs.
47 |
48 | ```
49 | chloroplast build
50 | chloroplast host
51 | ```
52 |
53 | This will build and then start hosting the docs from `localhost:5000`, launching a browser to preview them.
54 |
--------------------------------------------------------------------------------
/docs/SiteConfig.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # Site configuration file sample for chloroplast
3 |
4 | # site basics
5 | title: Chloroplast Docs
6 | email: hello@wildernesslabs.co
7 | description: >-
8 | Chloroplast by Wilderness Labs docs.
9 |
10 | # razor templates
11 | templates_folder: templates
12 |
13 | # main site folder
14 | areas:
15 | - source_folder: /source
16 | output_folder: /
17 |
--------------------------------------------------------------------------------
/docs/source/Installing/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | template: Default
3 | title: Installing Chloroplast
4 | ---
5 |
6 | # Dependencies
7 |
8 | You must have the `dotnet` CLI installed ... to do so, you need only install _.NET Core_ on your machine. The instructions for that can be found here:
9 |
10 | https://docs.microsoft.com/en-us/dotnet/core/install/
11 |
12 | # Installing Chloroplast
13 |
14 | You can acquire Chloroplast by installing it as either a [local or global
15 | tool](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-install).
16 |
17 |
18 | ## Wilderness Labs package registry
19 |
20 | ### Recommended
21 | Chloroplast can be found on the public nuget.org package registry at:
22 | https://www.nuget.org/packages/Chloroplast.Tool/
23 |
24 | ### Package Repository
25 | However you can also choose to install it through the Wilderness Labs package
26 | registry. This means you'll need to add the authenticated NuGet source as follows if you wish to do so.
27 |
28 | ```
29 | dotnet nuget add source https://nuget.pkg.github.com/WildernessLabs/index.json --name “wildernesslabs” --username << your github username >> --password << a personal access token >>
30 | ```
31 |
32 | ## Global
33 | Regardless of which package registry you choose, you can install Chloroplast as a global tool.
34 |
35 | ```
36 | dotnet tool install Chloroplast.Tool -g
37 | ```
38 |
39 | If you install it as a global tool, you can invoke it with the tool name
40 | `chloroplast`.
41 |
42 | ## Local
43 | Alternatively, you can install it as a local tool by first creating a local
44 | tool manifest in the project folder, as follows:
45 |
46 | ```
47 | dotnet new tool-manifest
48 | dotnet tool install Chloroplast.Tool
49 | ```
50 |
51 | If you install it as a local tool, you must prefix the tool name, so you can invoke it with `dotnet chloroplast`.
52 |
53 | ## Updating
54 |
55 | You can update to the latest release at any point by running the following command (with or without the `-g` depending on your preference):
56 |
57 | ```
58 | dotnet tool update Chloroplast.Tool -g
59 | ```
60 |
--------------------------------------------------------------------------------
/docs/source/apidocs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | template: Default
3 | title: API Docs
4 | ---
5 |
6 | Chloroplast supports documenting .NET APIs.
7 |
8 | **PLEASE NOTE:** This functionality is still in development and not fully released yet.
9 |
10 | ## Build Process
11 | The API build process is inherently a multi-step process, for which we'll use a few different tools:
12 |
13 | - [mdoc](https://github.com/mono/api-doc-tools/): This tool takes compiled .NET assemblies, and produces an XML format called EcmaXml, which represents all of the type and namespace metadata, and gives you an opportunity to document your APIs.
14 | - msbuild: We are going to use msbuild to fetch mdoc itself, along with all the APIs that you need documented.
15 | - Build Server: The glue that will drive and automate this process. In this document, we will use GitHub Actions to demonstrate the capabilities, but this can honestly be built with any other build pipeline such as Azure DevOps.
16 |
17 | ## Using MSBuild to Drive APIs
18 |
19 | ```xml
20 |
21 |
22 |
23 | netstandard2.1
24 | 5.8.2
25 | $(NuGetPackageRoot)mdoc\$(MdocVersion)\tools\mdoc.exe
26 | tmp/EcmaXml
27 |
28 | 0.5.0
29 | $(NuGetPackageRoot)chloroplast.core\$(ChloroplastCoreVersion)\lib\$(TargetFramework)\Chloroplast.Core.dll
30 |
31 | $(NuGetPackageRoot)minirazor\2.0.3\lib\$(TargetFramework)\
32 | $(NuGetPackageRoot)Microsoft.Extensions.Configuration.Abstractions\5.0.0\lib\netstandard2.0\
33 |
34 | $(ChloroplastCorePath)
35 | -L $(NuGetPackageRoot)
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | ```
51 |
52 | ## Using GitHub Actions to Automate Builds
53 |
54 | ```yaml
55 | name: Content Build
56 |
57 | on:
58 | workflow_dispatch:
59 | push:
60 | branches: [ main ]
61 | pull_request:
62 | branches: [ main ]
63 |
64 | jobs:
65 | build:
66 | runs-on: ubuntu-latest
67 |
68 | steps:
69 | - uses: actions/checkout@v2
70 |
71 | - name: Setup .NET Core
72 | uses: actions/setup-dotnet@v1
73 | with:
74 | dotnet-version: 3.1.x
75 |
76 | - name: Add private GitHub registry to NuGet
77 | run: dotnet nuget add source https://nuget.pkg.github.com/WildernessLabs/index.json --name "wildernesslabs" --username wildlingdev --password ${{ secrets.WILDLINGDEV_PAT }} --store-password-in-clear-text
78 |
79 | - name: Build APIs with mdoc
80 | run: |
81 | cd $GITHUB_WORKSPACE
82 | dotnet restore mdocbuild.csproj
83 | msbuild mdocbuild.csproj /t:mdocupdate
84 |
85 | - name: Install Chloroplast
86 | run: |
87 | dotnet new tool-manifest
88 | dotnet tool install Chloroplast.Tool
89 |
90 | # Runs a set of commands using the runners shell
91 | - name: Run a multi-line script
92 | run: |
93 | cd $GITHUB_WORKSPACE
94 | ls .
95 | dotnet chloroplast
96 | ls .
97 |
98 | - name: Upload a Build Artifact
99 | uses: actions/upload-artifact@v2.1.3
100 | with:
101 | name: output
102 | path: out/*
103 |
104 | - name: Publish to Web
105 | if: github.ref == 'refs/heads/main'
106 | uses: bacongobbler/azure-blob-storage-upload@v1.2.0
107 | with:
108 | source_dir: out
109 | container_name: $web
110 | connection_string: ${{ secrets.STORAGE_CONNECTION }}
111 | sync: true
112 |
113 | ```
114 |
115 | ## Supporting DocXML/Triple Slash docs
116 |
117 | WIP ...
118 |
--------------------------------------------------------------------------------
/docs/source/assets/main.css:
--------------------------------------------------------------------------------
1 | h1
2 | {
3 | margin:0;
4 | padding:10px;
5 | width:100%;
6 | background-color: darkgray;
7 | }
8 |
9 | #menu
10 | {
11 | float:left;
12 | width: 300px;
13 | background-color: white;
14 | }
15 |
16 | #maincontent
17 | {
18 | padding: 5px;
19 | }
20 |
21 | #body
22 | {
23 | margin-left: 300px;
24 | }
25 |
26 | #footer
27 | {
28 | border-top: 1px solid black;
29 | }
--------------------------------------------------------------------------------
/docs/source/cli/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | template: Default
3 | title: Command Line Interface
4 | ---
5 |
6 | Chloroplast supports various sub commands. It is recommended to first `cd` into your project's root folder, and run the commands with defaults as appropriate.
7 |
8 | ## `new` sub command
9 |
10 | The new subcommand allows you to bootstrap a chloroplast site by
11 | copying files to a destination folder.
12 |
13 | ```
14 | chloroplast new conceptual targetFolder
15 | ```
16 |
17 | This will create `targetFolder` (if it doesn't already exist), and
18 | copy files from the `conceptual` template. You can then run the
19 | following commands to build and preview the site locally:
20 |
21 | ```
22 | cd targetFolder
23 | chloroplast build
24 | chloroplast host
25 | ```
26 |
27 | ### parameters
28 |
29 | - `conceptual`: The second positional parameter after `new`.
30 | - This will currently only support `conceptual`, which will be a copy of these docs.
31 | - Eventually we will have more templates, and eventually open up to community contributions.
32 | - `targetFolder`: the third positional parameter after `new` is the name of the target folder where the template files will be placed.
33 |
34 | ## `build` sub command
35 |
36 | The build subcommand will build a Chloroplast site
37 |
38 | ```
39 | chloroplast build --root path/to/SiteConfig/ --out path/to/out
40 | ```
41 |
42 | ### parameters
43 |
44 | - `root`: the path to the directory that contains a `SiteConfig.yml` file
45 | - `out`: the path to the directory where the resulting HTML will be output.
46 | - `normalizePaths`: defaults to `true`, which normalizes all paths to lower case. Set this to false for output paths to match the source casing.
47 |
48 | The parameters above will default to the current working directory for the root path, and an `out/` directory in that same path if both parameters are omitted.
49 |
50 | The build command will render all `index.md` files into corresponding `index.html` files, and copy everything else to the same corresponding location (images, styles, etc).
51 |
52 | ## `host` sub command
53 |
54 | The host sub command starts a simple HTML web server. Useful for local preview during development or even authoring. If you update markdown files, the content will automatically be rebuilt so you can just refresh the browser.
55 |
56 | ```
57 | chloroplast host --root path/to/root --out path/to/html
58 | ```
59 |
60 | You can just press the enter key to end this task after stopping the web host with Ctrl+C at any time.
61 |
62 | If you are updating razor templates, you can also just run this command in a separate terminal window and leave it running. That way, as you run the full `build` subcommand, the content and front-end styles will update, and you can just refresh the browser after that build has completed.
63 |
64 | ### parameters
65 |
66 | - `out`: This should be the same value as the `out` parameter used in the `build` command.
67 |
68 | The parameter above will default to the `out/` folder in the current working directory, if omitted.
69 |
--------------------------------------------------------------------------------
/docs/source/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | template: Default
3 | title: Chloroplast Home
4 | subtitle: Documentation site for Chloroplast.
5 | ---
6 |
7 | # Welcome!
8 |
9 | To the Chloroplast docs. Once you [install it](/Installing), you can learn how to [use it](/cli), and [template it](/templates).
10 |
11 | The source code can be found here:
12 | https://github.com/wildernesslabs/Chloroplast
13 |
--------------------------------------------------------------------------------
/docs/source/menu.md:
--------------------------------------------------------------------------------
1 | ---
2 | template: menu
3 | navTree:
4 | - title: Installing
5 | path: Installing/
6 | - title: Command Line
7 | path: cli/
8 | - title: Templates
9 | path: templates/
10 | ---
11 | Copyright 2020 Wilderness Labs
--------------------------------------------------------------------------------
/docs/source/templates/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | template: Default
3 | title: Templating
4 | ---
5 |
6 | Chloroplast templates are built using ASP.NET's Razor templates.
7 |
8 | # Configuration
9 |
10 | The `SiteConfig.yml` file lets you configure the location of templates and the folders to find content files to process.
11 |
12 | ```yaml
13 | # razor templates
14 | templates_folder: templates
15 |
16 | areas:
17 | - source_folder: /source
18 | output_folder: /
19 | ```
20 |
21 | # Markdown front matter
22 |
23 | The template will be defined by the content's front matter.
24 |
25 | ```
26 | ---
27 | template: TemplateName
28 | title: Document title
29 | ---
30 | ```
31 |
32 | If this value is either incorrect, or omitted, it will default to look for a template named `Default.cshtml`. These templates are assumed to be just for the content area itself.
33 |
34 | # SiteFrame.cshtml
35 |
36 | For the main site's chrome, Chloroplast will look for a template named `SiteFrame.cshtml` ... this will render
37 |
38 | ```
39 |
40 |
41 | @Model.GetMeta("Title")
42 |
43 |
44 |
45 | @Raw(Model.Body)
46 |
47 |
48 |
49 | ```
50 |
51 | # Template Properties and Methods
52 |
53 | Available to all templates are the following functions:
54 |
55 | - `@Raw("")`
56 | - the `Raw` method will avoid HTML encoding content (which is the default).
57 | - `@Model.Body`
58 | - This is the main HTML content being rendered in this template. You should output this through the `Raw` method since it will likely contain HTML.
59 | - `@Model.GetMeta("title")`
60 | - with this you can access any value in the front matter (for example, `title`).
61 | - `@await PartialAsync("TemplateName", "model value")`
62 | - This lets you render sub templates.
63 | - the template name parameter will match the razor fil.e name ... so in the example above, it would be looking for a file named `Templates/TemplateName.cshtml`
64 | - the second parameter can be any kind of object really, whatever the template in question is expecting.
65 | - `@Model.Headers` collection
66 | - Each `h1`-`h6` will be parsed and added to this headers collection.
67 | - Every `Header` object has the following properties:
68 | - Level: the numeric value of the header
69 | - Value: the text
70 | - Slug: a slug version of the `Value`, which corresponds to an anchor added to the HTML before the header.
71 | - `@await PartialAsync("Docs/area/menu.md")`
72 | - This overload of the `PartialAsync` method assumes you're rendering a markdown file.
73 | - The markdown file can define its own template (will default to `Default`), and will only render the contents of that specific template (ie. no `SiteFrame.cshtml`).
74 |
--------------------------------------------------------------------------------
/docs/templates/Default.cshtml:
--------------------------------------------------------------------------------
1 | @inherits Chloroplast.Core.Rendering.ChloroplastTemplateBase
2 |