├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── dependabot.yml ├── stale.yml └── workflows │ ├── merge-dependabot.yml │ └── on-push-do-docs.yml ├── .gitignore ├── code_of_conduct.md ├── license.txt ├── readme.md └── src ├── .editorconfig ├── .gitattributes ├── Directory.Build.props ├── Directory.Packages.props ├── PandocNet.sln ├── PandocNet.sln.DotSettings ├── PandocNet ├── ErrorCodes.cs ├── GlobalUsings.cs ├── Input.cs ├── Input │ ├── BibLaTeXIn.cs │ ├── BibTexIn.cs │ ├── CreoleIn.cs │ ├── CsvIn.cs │ ├── DocBookIn.cs │ ├── DocxIn.cs │ ├── DokuWikiIn.cs │ ├── EmacsOrgIn.cs │ ├── EpubIn.cs │ ├── Fib2In.cs │ ├── GhMdIn.cs │ ├── HaddockIn.cs │ ├── HaskellIn.cs │ ├── HtmlIn.cs │ ├── InOptions.cs │ ├── JatsIn.cs │ ├── JiraIn.cs │ ├── JsonIn.cs │ ├── JupyterIn.cs │ ├── LaTexIn.cs │ ├── Markdown │ │ ├── CommonMarkIn.cs │ │ ├── CommonMarkXIn.cs │ │ ├── MdStrictIn.cs │ │ ├── MultiMdIn.cs │ │ ├── PandocMdIn.cs │ │ └── PhpMdExtraIn.cs │ ├── MediaWikiIn.cs │ ├── MuseIn.cs │ ├── OdtIn.cs │ ├── OpmlIn.cs │ ├── RoffManIn.cs │ ├── RstIn.cs │ ├── RtfIn.cs │ ├── T2tIn.cs │ ├── TWikiIn.cs │ ├── TextileIn.cs │ ├── TikiWikiIn.cs │ ├── TrackChanges.cs │ └── VimWikiIn.cs ├── Options.cs ├── Output.cs ├── Output │ ├── AsciiDocOut.cs │ ├── AsciiDoctorOut.cs │ ├── BibLaTeXOut.cs │ ├── BibTeXOut.cs │ ├── ConTeXtOut.cs │ ├── CslJsonOut.cs │ ├── DocBook4Out.cs │ ├── DocBook5Out.cs │ ├── DocxOut.cs │ ├── DokuWikiOut.cs │ ├── EmacsOrgOut.cs │ ├── Eol.cs │ ├── Epub2Out.cs │ ├── Epub3Out.cs │ ├── Fb2Out.cs │ ├── HaddockOut.cs │ ├── HaskellOut.cs │ ├── HtmlOut.cs │ ├── IcmlOut.cs │ ├── JatsArchivingOut.cs │ ├── JatsArticleAuthoringOut.cs │ ├── JatsPublishingOut.cs │ ├── JiraOut.cs │ ├── JsonOut.cs │ ├── JupyterCellOut.cs │ ├── JupyterOut.cs │ ├── LaTeXOut.cs │ ├── Markdown │ │ ├── CommonMarkOut.cs │ │ ├── CommonMarkXOut.cs │ │ ├── GhMdOut.cs │ │ ├── MarkdownHeadings.cs │ │ ├── MdStrictOut.cs │ │ ├── MultiMdOut.cs │ │ ├── PandocMdOut.cs │ │ └── PhpMdExtraOut.cs │ ├── MediaWikiOut.cs │ ├── MuseOut.cs │ ├── OdtOut.cs │ ├── OpenDocumentOut.cs │ ├── OpmlOut.cs │ ├── OutOptions.cs │ ├── Pdf │ │ ├── PdfEngine.cs │ │ └── PdfOut.cs │ ├── ReferenceLocation.cs │ ├── RoffManOut.cs │ ├── RoffMsOut.cs │ ├── RstOut.cs │ ├── RtfOut.cs │ ├── Slides │ │ ├── BeamerOut.cs │ │ ├── DzSlidesOut.cs │ │ ├── PptxOut.cs │ │ ├── RevealJsOut.cs │ │ ├── S5Out.cs │ │ ├── SlideousOut.cs │ │ └── SlidyOut.cs │ ├── TeiOut.cs │ ├── TexInfoOut.cs │ ├── TextileOut.cs │ ├── TopLevelDivision.cs │ ├── TxtOut.cs │ ├── Wrap.cs │ ├── XWikiOut.cs │ └── ZimWikiOut.cs ├── Pandoc.csproj ├── PandocEngine.cs ├── PandocInstance.cs ├── Result.cs └── StringResult.cs ├── Shared.sln.DotSettings ├── Tests ├── output.html ├── GlobalUsings.cs ├── ModuleInitializer.cs ├── Samples.CustomOptions.Windows.verified.html ├── Samples.Files.Linux.verified.html ├── Samples.Files.Windows.verified.html ├── Samples.Streams.Linux.verified.html ├── Samples.Streams.Windows.verified.html ├── Samples.Text.Linux.verified.html ├── Samples.Text.Windows.verified.html ├── Samples.cs ├── Tests.BinaryToText.Windows.verified.html ├── Tests.BinaryToText.Windows.verified.txt ├── Tests.CustomOptions.Windows.verified.html ├── Tests.CustomOptions.Windows.verified.txt ├── Tests.DataDirectory.Linux.verified.html ├── Tests.DataDirectory.Linux.verified.txt ├── Tests.DataDirectory.Windows.verified.html ├── Tests.DataDirectory.Windows.verified.txt ├── Tests.EncodingTest.Linux.verified.md ├── Tests.EncodingTest.Linux.verified.txt ├── Tests.EncodingTest.Windows.verified.md ├── Tests.EncodingTest.Windows.verified.txt ├── Tests.Files.Linux.verified.html ├── Tests.Files.Linux.verified.txt ├── Tests.Files.Windows.verified.html ├── Tests.Files.Windows.verified.txt ├── Tests.InputOutput.Linux.verified.html ├── Tests.InputOutput.Linux.verified.txt ├── Tests.InputOutput.Windows.verified.html ├── Tests.InputOutput.Windows.verified.txt ├── Tests.Streams.Linux.verified.html ├── Tests.Streams.Linux.verified.txt ├── Tests.Streams.Windows.verified.html ├── Tests.Streams.Windows.verified.txt ├── Tests.Text.Linux.verified.html ├── Tests.Text.Linux.verified.txt ├── Tests.Text.Windows.verified.html ├── Tests.Text.Windows.verified.txt ├── Tests.TextFromStream.Linux.verified.html ├── Tests.TextFromStream.Linux.verified.txt ├── Tests.TextFromStream.Windows.verified.html ├── Tests.TextFromStream.Windows.verified.txt ├── Tests.cs ├── Tests.csproj ├── VerifyChecksTests.cs ├── sample.docx ├── sample.md ├── sample.pdf ├── sample.pptx └── sample.xlsx ├── appveyor.yml ├── global.json ├── icon.png ├── input.include.md ├── key.snk ├── mdsnippets.json ├── nuget.config └── output.include.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: SimonCropp -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug fix 3 | about: Create a bug fix to help us improve 4 | --- 5 | 6 | Note: New issues raised, where it is clear the submitter has not read the issue template, are likely to be closed with "please read the issue template". Please don't take offense at this. It is simply a time management decision. If someone raises an issue, and can't be bothered to spend the time to read the issue template, then the project maintainers should not be expected to spend the time to read the submitted issue. Often too much time is spent going back and forth in issue comments asking for information that is outlined in the issue template. 7 | 8 | 9 | #### Preamble 10 | 11 | General questions may be better placed [StackOveflow](https://stackoverflow.com/). 12 | 13 | Where relevant, ensure you are using the current stable versions on your development stack. For example: 14 | 15 | * Visual Studio 16 | * [.NET SDK or .NET Core SDK](https://www.microsoft.com/net/download) 17 | * Any related NuGet packages 18 | 19 | Any code or stack traces must be properly formatted with [GitHub markdown](https://guides.github.com/features/mastering-markdown/). 20 | 21 | 22 | #### Describe the bug 23 | 24 | A clear and concise description of what the bug is. Include any relevant version information. 25 | 26 | A clear and concise description of what you expected to happen. 27 | 28 | Add any other context about the problem here. 29 | 30 | 31 | #### Minimal Repro 32 | 33 | Ensure you have replicated the bug in a minimal solution with the fewest moving parts. Often this will help point to the true cause of the problem. Upload this repro as part of the issue, preferably a public GitHub repository or a downloadable zip. The repro will allow the maintainers of this project to smoke test the any fix. 34 | 35 | #### Submit a PR that fixes the bug 36 | 37 | Submit a [Pull Request (PR)](https://help.github.com/articles/about-pull-requests/) that fixes the bug. Include in this PR a test that verifies the fix. If you were not able to fix the bug, a PR that illustrates your partial progress will suffice. 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: How to raise feature requests 4 | --- 5 | 6 | 7 | Note: New issues raised, where it is clear the submitter has not read the issue template, are likely to be closed with "please read the issue template". Please don't take offense at this. It is simply a time management decision. If someone raises an issue, and can't be bothered to spend the time to read the issue template, then the project maintainers should not be expected to spend the time to read the submitted issue. Often too much time is spent going back and forth in issue comments asking for information that is outlined in the issue template. 8 | 9 | If you are certain the feature will be accepted, it is better to raise a [Pull Request (PR)](https://help.github.com/articles/about-pull-requests/). 10 | 11 | If you are uncertain if the feature will be accepted, outline the proposal below to confirm it is viable, prior to raising a PR that implements the feature. 12 | 13 | Note that even if the feature is a good idea and viable, it may not be accepted since the ongoing effort in maintaining the feature may outweigh the benefit it delivers. 14 | 15 | 16 | #### Is the feature request related to a problem 17 | 18 | A clear and concise description of what the problem is. 19 | 20 | 21 | #### Describe the solution 22 | 23 | A clear and concise proposal of how you intend to implement the feature. 24 | 25 | 26 | #### Describe alternatives considered 27 | 28 | A clear and concise description of any alternative solutions or features you've considered. 29 | 30 | 31 | #### Additional context 32 | 33 | Add any other context about the feature request here. 34 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: nuget 4 | directory: "/src" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 7 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Set to true to ignore issues in a milestone (defaults to false) 6 | exemptMilestones: true 7 | # Comment to post when marking an issue as stale. Set to `false` to disable 8 | markComment: > 9 | This issue has been automatically marked as stale because it has not had 10 | recent activity. It will be closed if no further activity occurs. Thank you 11 | for your contributions. 12 | # Comment to post when closing a stale issue. Set to `false` to disable 13 | closeComment: false 14 | # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': 15 | pulls: 16 | daysUntilStale: 30 17 | exemptLabels: 18 | - Question 19 | - Bug 20 | - Feature 21 | - Improvement -------------------------------------------------------------------------------- /.github/workflows/merge-dependabot.yml: -------------------------------------------------------------------------------- 1 | name: merge-dependabot 2 | on: 3 | pull_request: 4 | jobs: 5 | automerge: 6 | runs-on: ubuntu-latest 7 | if: github.actor == 'dependabot[bot]' 8 | steps: 9 | - name: Dependabot Auto Merge 10 | uses: ahmadnassri/action-dependabot-auto-merge@v2.6.6 11 | with: 12 | target: minor 13 | github-token: ${{ secrets.dependabot }} 14 | command: squash and merge -------------------------------------------------------------------------------- /.github/workflows/on-push-do-docs.yml: -------------------------------------------------------------------------------- 1 | name: on-push-do-docs 2 | on: 3 | push: 4 | jobs: 5 | docs: 6 | runs-on: windows-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - name: Run MarkdownSnippets 10 | run: | 11 | dotnet tool install --global MarkdownSnippets.Tool 12 | mdsnippets ${GITHUB_WORKSPACE} 13 | shell: bash 14 | - name: Push changes 15 | run: | 16 | git config --local user.email "action@github.com" 17 | git config --local user.name "GitHub Action" 18 | git commit -m "Docs changes" -a || echo "nothing to commit" 19 | remote="https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git" 20 | branch="${GITHUB_REF:11}" 21 | git push "${remote}" ${branch} || echo "nothing to push" 22 | shell: bash -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | bin/ 4 | obj/ 5 | .vs/ 6 | *.DotSettings.user 7 | .idea/ 8 | *.received.* 9 | nugets/ -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/about/code-of-conduct). 6 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) .NET Foundation and Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | 6 | [*.cs] 7 | indent_size = 4 8 | charset = utf-8 9 | 10 | # Redundant accessor body 11 | resharper_redundant_accessor_body_highlighting = error 12 | 13 | # Replace with field keyword 14 | resharper_replace_with_field_keyword_highlighting = error 15 | 16 | # Replace with single call to Single(..) 17 | resharper_replace_with_single_call_to_single_highlighting = error 18 | 19 | # Replace with single call to SingleOrDefault(..) 20 | resharper_replace_with_single_call_to_single_or_default_highlighting = error 21 | 22 | # Replace with single call to LastOrDefault(..) 23 | resharper_replace_with_single_call_to_last_or_default_highlighting = error 24 | 25 | # Replace with single call to Last(..) 26 | resharper_replace_with_single_call_to_last_highlighting = error 27 | 28 | # Replace with single call to First(..) 29 | resharper_replace_with_single_call_to_first_highlighting = error 30 | 31 | # Replace with single call to FirstOrDefault(..) 32 | resharper_replace_with_single_call_to_first_or_default_highlighting = error 33 | 34 | # Replace with single call to Any(..) 35 | resharper_replace_with_single_call_to_any_highlighting = error 36 | 37 | # Replace with single call to Count(..) 38 | resharper_replace_with_single_call_to_count_highlighting = error 39 | 40 | # Declare types in namespaces 41 | dotnet_diagnostic.CA1050.severity = none 42 | 43 | # Use Literals Where Appropriate 44 | dotnet_diagnostic.CA1802.severity = error 45 | 46 | # Template should be a static expression 47 | dotnet_diagnostic.CA2254.severity = error 48 | 49 | # Potentially misleading parameter name in lambda or local function 50 | resharper_all_underscore_local_parameter_name_highlighting = none 51 | 52 | # Redundant explicit collection creation in argument of 'params' parameter 53 | resharper_redundant_explicit_params_array_creation_highlighting = error 54 | 55 | # Do not initialize unnecessarily 56 | dotnet_diagnostic.CA1805.severity = error 57 | 58 | # Avoid unsealed attributes 59 | dotnet_diagnostic.CA1813.severity = error 60 | 61 | # Test for empty strings using string length 62 | dotnet_diagnostic.CA1820.severity = none 63 | 64 | # Remove empty finalizers 65 | dotnet_diagnostic.CA1821.severity = error 66 | 67 | # Mark members as static 68 | dotnet_diagnostic.CA1822.severity = error 69 | 70 | # Avoid unused private fields 71 | dotnet_diagnostic.CA1823.severity = error 72 | 73 | # Avoid zero-length array allocations 74 | dotnet_diagnostic.CA1825.severity = error 75 | 76 | # Use property instead of Linq Enumerable method 77 | dotnet_diagnostic.CA1826.severity = error 78 | 79 | # Do not use Count()/LongCount() when Any() can be used 80 | dotnet_diagnostic.CA1827.severity = error 81 | dotnet_diagnostic.CA1828.severity = error 82 | 83 | # Use Length/Count property instead of Enumerable.Count method 84 | dotnet_diagnostic.CA1829.severity = error 85 | 86 | # Prefer strongly-typed Append and Insert method overloads on StringBuilder 87 | dotnet_diagnostic.CA1830.severity = error 88 | 89 | # Use AsSpan instead of Range-based indexers for string when appropriate 90 | dotnet_diagnostic.CA1831.severity = error 91 | 92 | # Use AsSpan instead of Range-based indexers for string when appropriate 93 | dotnet_diagnostic.CA1831.severity = error 94 | dotnet_diagnostic.CA1832.severity = error 95 | dotnet_diagnostic.CA1833.severity = error 96 | 97 | # Use StringBuilder.Append(char) for single character strings 98 | dotnet_diagnostic.CA1834.severity = error 99 | 100 | # Prefer IsEmpty over Count when available 101 | dotnet_diagnostic.CA1836.severity = error 102 | 103 | # Prefer IsEmpty over Count when available 104 | dotnet_diagnostic.CA1836.severity = error 105 | 106 | # Use Environment.ProcessId instead of Process.GetCurrentProcess().Id 107 | dotnet_diagnostic.CA1837.severity = error 108 | 109 | # Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName 110 | dotnet_diagnostic.CA1839.severity = error 111 | 112 | # Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId 113 | dotnet_diagnostic.CA1840.severity = error 114 | 115 | # Prefer Dictionary Contains methods 116 | dotnet_diagnostic.CA1841.severity = error 117 | 118 | # Do not use WhenAll with a single task 119 | dotnet_diagnostic.CA1842.severity = error 120 | 121 | # Do not use WhenAll/WaitAll with a single task 122 | dotnet_diagnostic.CA1842.severity = error 123 | dotnet_diagnostic.CA1843.severity = error 124 | 125 | # Use span-based 'string.Concat' 126 | dotnet_diagnostic.CA1845.severity = error 127 | 128 | # Prefer AsSpan over Substring 129 | dotnet_diagnostic.CA1846.severity = error 130 | 131 | # Use string.Contains(char) instead of string.Contains(string) with single characters 132 | dotnet_diagnostic.CA1847.severity = error 133 | 134 | # Prefer static HashData method over ComputeHash 135 | dotnet_diagnostic.CA1850.severity = error 136 | 137 | # Possible multiple enumerations of IEnumerable collection 138 | dotnet_diagnostic.CA1851.severity = error 139 | 140 | # Unnecessary call to Dictionary.ContainsKey(key) 141 | dotnet_diagnostic.CA1853.severity = error 142 | 143 | # Prefer the IDictionary.TryGetValue(TKey, out TValue) method 144 | dotnet_diagnostic.CA1854.severity = error 145 | 146 | # Use Span.Clear() instead of Span.Fill() 147 | dotnet_diagnostic.CA1855.severity = error 148 | 149 | # Incorrect usage of ConstantExpected attribute 150 | dotnet_diagnostic.CA1856.severity = error 151 | 152 | # The parameter expects a constant for optimal performance 153 | dotnet_diagnostic.CA1857.severity = error 154 | 155 | # Use StartsWith instead of IndexOf 156 | dotnet_diagnostic.CA1858.severity = error 157 | 158 | # Avoid using Enumerable.Any() extension method 159 | dotnet_diagnostic.CA1860.severity = error 160 | 161 | # Avoid constant arrays as arguments 162 | dotnet_diagnostic.CA1861.severity = error 163 | 164 | # Use the StringComparison method overloads to perform case-insensitive string comparisons 165 | dotnet_diagnostic.CA1862.severity = error 166 | 167 | # Prefer the IDictionary.TryAdd(TKey, TValue) method 168 | dotnet_diagnostic.CA1864.severity = error 169 | 170 | # Use string.Method(char) instead of string.Method(string) for string with single char 171 | dotnet_diagnostic.CA1865.severity = error 172 | dotnet_diagnostic.CA1866.severity = error 173 | dotnet_diagnostic.CA1867.severity = error 174 | 175 | # Unnecessary call to 'Contains' for sets 176 | dotnet_diagnostic.CA1868.severity = error 177 | 178 | # Cache and reuse 'JsonSerializerOptions' instances 179 | dotnet_diagnostic.CA1869.severity = error 180 | 181 | # Use a cached 'SearchValues' instance 182 | dotnet_diagnostic.CA1870.severity = error 183 | 184 | # Microsoft .NET properties 185 | trim_trailing_whitespace = true 186 | csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion 187 | resharper_namespace_body = file_scoped 188 | dotnet_naming_rule.private_constants_rule.severity = warning 189 | dotnet_naming_rule.private_constants_rule.style = lower_camel_case_style 190 | dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols 191 | dotnet_naming_rule.private_instance_fields_rule.severity = warning 192 | dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style 193 | dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols 194 | dotnet_naming_rule.private_static_fields_rule.severity = warning 195 | dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style 196 | dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols 197 | dotnet_naming_rule.private_static_readonly_rule.severity = warning 198 | dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style 199 | dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols 200 | dotnet_naming_style.lower_camel_case_style.capitalization = camel_case 201 | dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case 202 | dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private 203 | dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field 204 | dotnet_naming_symbols.private_constants_symbols.required_modifiers = const 205 | dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private 206 | dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field 207 | dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private 208 | dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field 209 | dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static 210 | dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private 211 | dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field 212 | dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly 213 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none 214 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none 215 | dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none 216 | 217 | # ReSharper properties 218 | resharper_object_creation_when_type_not_evident = target_typed 219 | 220 | # ReSharper inspection severities 221 | resharper_arrange_object_creation_when_type_evident_highlighting = error 222 | resharper_arrange_object_creation_when_type_not_evident_highlighting = error 223 | resharper_arrange_redundant_parentheses_highlighting = error 224 | resharper_arrange_static_member_qualifier_highlighting = error 225 | resharper_arrange_this_qualifier_highlighting = error 226 | resharper_arrange_type_member_modifiers_highlighting = none 227 | resharper_built_in_type_reference_style_for_member_access_highlighting = hint 228 | resharper_built_in_type_reference_style_highlighting = hint 229 | resharper_check_namespace_highlighting = none 230 | resharper_convert_to_using_declaration_highlighting = error 231 | resharper_css_not_resolved_highlighting = warning 232 | resharper_field_can_be_made_read_only_local_highlighting = none 233 | resharper_merge_into_logical_pattern_highlighting = warning 234 | resharper_merge_into_pattern_highlighting = error 235 | resharper_method_has_async_overload_highlighting = warning 236 | # because stop rider giving errors before source generators have run 237 | resharper_partial_type_with_single_part_highlighting = warning 238 | resharper_redundant_base_qualifier_highlighting = warning 239 | resharper_redundant_cast_highlighting = error 240 | resharper_redundant_empty_object_creation_argument_list_highlighting = error 241 | resharper_redundant_empty_object_or_collection_initializer_highlighting = error 242 | resharper_redundant_name_qualifier_highlighting = error 243 | resharper_redundant_suppress_nullable_warning_expression_highlighting = error 244 | resharper_redundant_using_directive_highlighting = error 245 | resharper_redundant_verbatim_string_prefix_highlighting = error 246 | resharper_redundant_lambda_signature_parentheses_highlighting = error 247 | resharper_replace_substring_with_range_indexer_highlighting = warning 248 | resharper_suggest_var_or_type_built_in_types_highlighting = error 249 | resharper_suggest_var_or_type_elsewhere_highlighting = error 250 | resharper_suggest_var_or_type_simple_types_highlighting = error 251 | resharper_unnecessary_whitespace_highlighting = error 252 | resharper_use_await_using_highlighting = warning 253 | resharper_use_deconstruction_highlighting = warning 254 | 255 | # Sort using and Import directives with System.* appearing first 256 | dotnet_sort_system_directives_first = true 257 | 258 | # Avoid "this." and "Me." if not necessary 259 | dotnet_style_qualification_for_field = false:error 260 | dotnet_style_qualification_for_property = false:error 261 | dotnet_style_qualification_for_method = false:error 262 | dotnet_style_qualification_for_event = false:error 263 | 264 | # Use language keywords instead of framework type names for type references 265 | dotnet_style_predefined_type_for_locals_parameters_members = true:error 266 | dotnet_style_predefined_type_for_member_access = true:error 267 | 268 | # Suggest more modern language features when available 269 | dotnet_style_object_initializer = true:error 270 | dotnet_style_collection_initializer = true:error 271 | dotnet_style_coalesce_expression = false:error 272 | dotnet_style_null_propagation = true:error 273 | dotnet_style_explicit_tuple_names = true:error 274 | 275 | # Use collection expression syntax 276 | resharper_use_collection_expression_highlighting = error 277 | 278 | # Prefer "var" everywhere 279 | csharp_style_var_for_built_in_types = true:error 280 | csharp_style_var_when_type_is_apparent = true:error 281 | csharp_style_var_elsewhere = true:error 282 | 283 | # Prefer method-like constructs to have a block body 284 | csharp_style_expression_bodied_methods = true:error 285 | csharp_style_expression_bodied_local_functions = true:error 286 | csharp_style_expression_bodied_constructors = true:error 287 | csharp_style_expression_bodied_operators = true:error 288 | resharper_place_expr_method_on_single_line = false 289 | 290 | # Prefer property-like constructs to have an expression-body 291 | csharp_style_expression_bodied_properties = true:error 292 | csharp_style_expression_bodied_indexers = true:error 293 | csharp_style_expression_bodied_accessors = true:error 294 | 295 | # Suggest more modern language features when available 296 | csharp_style_pattern_matching_over_is_with_cast_check = true:error 297 | csharp_style_pattern_matching_over_as_with_null_check = true:error 298 | csharp_style_inlined_variable_declaration = true:suggestion 299 | csharp_style_throw_expression = true:suggestion 300 | csharp_style_conditional_delegate_call = true:suggestion 301 | 302 | # Newline settings 303 | #csharp_new_line_before_open_brace = all:error 304 | resharper_max_array_initializer_elements_on_line = 1 305 | csharp_new_line_before_else = true 306 | csharp_new_line_before_catch = true 307 | csharp_new_line_before_finally = true 308 | csharp_new_line_before_members_in_object_initializers = true 309 | csharp_new_line_before_members_in_anonymous_types = true 310 | resharper_wrap_before_first_type_parameter_constraint = true 311 | resharper_wrap_extends_list_style = chop_always 312 | resharper_wrap_after_dot_in_method_calls = false 313 | resharper_wrap_before_binary_pattern_op = false 314 | resharper_wrap_object_and_collection_initializer_style = chop_always 315 | resharper_place_simple_initializer_on_single_line = false 316 | 317 | # space 318 | resharper_space_around_lambda_arrow = true 319 | 320 | dotnet_style_require_accessibility_modifiers = never:error 321 | resharper_place_type_constraints_on_same_line = false 322 | resharper_blank_lines_inside_namespace = 0 323 | resharper_blank_lines_after_file_scoped_namespace_directive = 1 324 | resharper_blank_lines_inside_type = 0 325 | 326 | insert_final_newline = false 327 | resharper_place_attribute_on_same_line = false 328 | resharper_space_around_lambda_arrow = true 329 | resharper_place_constructor_initializer_on_same_line = false 330 | 331 | #braces https://www.jetbrains.com/help/resharper/EditorConfig_CSHARP_CSharpCodeStylePageImplSchema.html#Braces 332 | resharper_braces_for_ifelse = required 333 | resharper_braces_for_foreach = required 334 | resharper_braces_for_while = required 335 | resharper_braces_for_dowhile = required 336 | resharper_braces_for_lock = required 337 | resharper_braces_for_fixed = required 338 | resharper_braces_for_for = required 339 | 340 | resharper_return_value_of_pure_method_is_not_used_highlighting = error 341 | 342 | resharper_all_underscore_local_parameter_name_highlighting = none 343 | 344 | resharper_misleading_body_like_statement_highlighting = error 345 | 346 | resharper_redundant_record_class_keyword_highlighting = error 347 | 348 | resharper_redundant_extends_list_entry_highlighting = error 349 | 350 | # Xml files 351 | [*.{xml,config,nuspec,resx,vsixmanifest,csproj,targets,props,fsproj}] 352 | indent_size = 2 353 | # https://www.jetbrains.com/help/resharper/EditorConfig_XML_XmlCodeStylePageSchema.html#resharper_xml_blank_line_after_pi 354 | resharper_blank_line_after_pi = false 355 | resharper_space_before_self_closing = true 356 | ij_xml_space_inside_empty_tag = true 357 | 358 | [*.json] 359 | indent_size = 2 360 | 361 | # Verify settings 362 | [*.{received,verified}.{txt,xml,json,md,sql,csv,html,htm,md}] 363 | charset = utf-8-bom 364 | end_of_line = lf 365 | indent_size = unset 366 | indent_style = unset 367 | insert_final_newline = false 368 | tab_width = unset 369 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /src/.gitattributes: -------------------------------------------------------------------------------- 1 | * text 2 | *.snk binary 3 | *.pdf binary 4 | *.docx binary 5 | *.png binary 6 | *.xlsx binary 7 | *.pptx binary 8 | *.ppt binary 9 | 10 | *.verified.html text eol=lf working-tree-encoding=UTF-8 11 | *.verified.htm text eol=lf working-tree-encoding=UTF-8 12 | *.verified.md text eol=lf working-tree-encoding=UTF-8 13 | *.verified.txt text eol=lf working-tree-encoding=UTF-8 14 | 15 | .editorconfig text eol=lf working-tree-encoding=UTF-8 16 | Shared.sln.DotSettings text eol=lf working-tree-encoding=UTF-8 -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CS1591;CS0649;NU1608;NU1109 5 | 3.3.0 6 | preview 7 | 1.0.0 8 | Pandoc, Document, Conversion 9 | Conversion of document via Pandoc. 10 | true 11 | true 12 | true 13 | true 14 | true 15 | 16 | -------------------------------------------------------------------------------- /src/Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | true 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/PandocNet.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.31903.286 5 | MinimumVisualStudioVersion = 16.0.29201.188 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pandoc", "PandocNet\Pandoc.csproj", "{C35E31DE-40A9-45C0-817B-41BE5B7D076E}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{76FE87D9-EF6B-4D31-99F2-7099C719AE99}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9A6C4741-C83D-4E05-A62F-8049F65B9B6C}" 11 | ProjectSection(SolutionItems) = preProject 12 | .editorconfig = .editorconfig 13 | .gitattributes = .gitattributes 14 | ..\.gitignore = ..\.gitignore 15 | appveyor.yml = appveyor.yml 16 | Directory.Build.props = Directory.Build.props 17 | mdsnippets.json = mdsnippets.json 18 | ..\readme.md = ..\readme.md 19 | Directory.Packages.props = Directory.Packages.props 20 | global.json = global.json 21 | EndProjectSection 22 | EndProject 23 | Global 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|Any CPU = Debug|Any CPU 26 | Release|Any CPU = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {C35E31DE-40A9-45C0-817B-41BE5B7D076E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {C35E31DE-40A9-45C0-817B-41BE5B7D076E}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {C35E31DE-40A9-45C0-817B-41BE5B7D076E}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {C35E31DE-40A9-45C0-817B-41BE5B7D076E}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {76FE87D9-EF6B-4D31-99F2-7099C719AE99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {76FE87D9-EF6B-4D31-99F2-7099C719AE99}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {76FE87D9-EF6B-4D31-99F2-7099C719AE99}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {76FE87D9-EF6B-4D31-99F2-7099C719AE99}.Release|Any CPU.Build.0 = Release|Any CPU 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | SolutionGuid = {B0B94980-5385-4EC6-A0EE-C9A191DDFC05} 43 | EndGlobalSection 44 | EndGlobal 45 | -------------------------------------------------------------------------------- /src/PandocNet.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | ..\Shared.sln.DotSettings 3 | True 4 | True 5 | 1 6 | -------------------------------------------------------------------------------- /src/PandocNet/ErrorCodes.cs: -------------------------------------------------------------------------------- 1 | //https://pandoc.org/MANUAL.html#exit-codes 2 | static class ErrorCodes 3 | { 4 | public static string GetErrorType(int exitCode) => 5 | exitCode switch 6 | { 7 | 3 => "PandocFailOnWarningError", 8 | 4 => "PandocAppError", 9 | 5 => "PandocTemplateError", 10 | 6 => "PandocOptionError", 11 | 21 => "PandocUnknownReaderError", 12 | 22 => "PandocUnknownWriterError", 13 | 24 => "PandocCiteprocError", 14 | 25 => "PandocBibliographyError", 15 | 31 => "PandocEpubSubdirectoryError", 16 | 43 => "PandocPDFError", 17 | 44 => "PandocXMLError", 18 | 47 => "PandocPDFProgramNotFoundError", 19 | 61 => "PandocHttpError", 20 | 62 => "PandocShouldNeverHappenError", 21 | 63 => "PandocSomeError", 22 | 64 => "PandocParseError", 23 | 65 => "PandocParsecError", 24 | 67 => "PandocSyntaxMapError", 25 | 83 => "PandocFilterError", 26 | 91 => "PandocMacroLoop", 27 | 92 => "PandocUTF8DecodingError", 28 | 93 => "PandocIpynbDecodingError", 29 | 94 => "PandocUnsupportedCharsetError", 30 | 97 => "PandocCouldNotFindDataFileError", 31 | 99 => "PandocResourceNotFound", 32 | _ => "PandocUnknownError" 33 | }; 34 | } -------------------------------------------------------------------------------- /src/PandocNet/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using CliWrap; 2 | global using Replicant; -------------------------------------------------------------------------------- /src/PandocNet/Input.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class Input 4 | { 5 | string? file; 6 | string? url; 7 | string? content; 8 | byte[]? bytes; 9 | Stream? stream; 10 | 11 | public Input(string value) 12 | { 13 | if (value.StartsWith("http://") || 14 | value.StartsWith("https://")) 15 | { 16 | url = value; 17 | return; 18 | } 19 | 20 | if (File.Exists(value)) 21 | { 22 | file = value; 23 | return; 24 | } 25 | 26 | content = value; 27 | } 28 | 29 | public Input(Stream stream) => 30 | this.stream = stream; 31 | 32 | public Input(byte[] bytes) => 33 | this.bytes = bytes; 34 | 35 | public static implicit operator Input(string value) => new(value); 36 | public static implicit operator Input(Stream stream) => new(stream); 37 | public static implicit operator Input(byte[] bytes) => new(bytes); 38 | 39 | public PipeSource GetPipeSource() 40 | { 41 | if (file != null) 42 | { 43 | return PipeSource.FromFile(file); 44 | } 45 | 46 | if (stream != null) 47 | { 48 | return PipeSource.FromStream(stream); 49 | } 50 | 51 | if (bytes != null) 52 | { 53 | return PipeSource.FromBytes(bytes); 54 | } 55 | 56 | if (url != null) 57 | { 58 | var stream = HttpCache.Default.Stream(url); 59 | return PipeSource.FromStream(stream); 60 | } 61 | 62 | if (content != null) 63 | { 64 | return PipeSource.FromString(content, Encoding.UTF8); 65 | } 66 | 67 | throw new("Unknown output"); 68 | } 69 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/BibLaTeXIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://ctan.org/pkg/biblatex 5 | /// 6 | public class BibLaTeXIn : 7 | InOptions 8 | { 9 | protected override string Format => "biblatex"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/BibTexIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://ctan.org/pkg/bibtex 5 | /// 6 | public class BibTexIn : 7 | InOptions 8 | { 9 | protected override string Format => "bibtex"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/CreoleIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://www.wikicreole.org/wiki/Creole1.0 5 | /// 6 | public class CreoleIn : 7 | InOptions 8 | { 9 | protected override string Format => "creole"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/CsvIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://datatracker.ietf.org/doc/html/rfc4180 5 | /// 6 | public class CsvIn : 7 | InOptions 8 | { 9 | protected override string Format => "csv"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/DocBookIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://docbook.org/ 5 | /// 6 | public class DocBookIn : 7 | InOptions 8 | { 9 | protected override string Format => "docbook"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/DocxIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/Office_Open_XML 5 | /// 6 | public class DocxIn : 7 | InOptions 8 | { 9 | protected override string Format => "docx"; 10 | 11 | /// 12 | /// Specifies what to do with insertions, deletions, and comments produced 13 | /// https://pandoc.org/MANUAL.html#option--track-changes 14 | /// 15 | public TrackChanges? TrackChanges { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (TrackChanges != null) 25 | { 26 | yield return $"--track-changes={TrackChanges.Value.ToString().ToLower()}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/DokuWikiIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.dokuwiki.org/dokuwiki 5 | /// 6 | public class DokuWikiIn : 7 | InOptions 8 | { 9 | protected override string Format => "dokuwiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/EmacsOrgIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://orgmode.org/ 5 | /// 6 | public class EmacsOrgIn : 7 | InOptions 8 | { 9 | protected override string Format => "org"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/EpubIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://idpf.org/epub 5 | /// 6 | public class EpubIn : 7 | InOptions 8 | { 9 | protected override string Format => "epub"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Fib2In.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1 5 | /// 6 | public class Fib2In : 7 | InOptions 8 | { 9 | protected override string Format => "fb2"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/GhMdIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://help.github.com/articles/github-flavored-markdown/ 5 | /// 6 | public class GhMdIn : 7 | InOptions 8 | { 9 | protected override string Format => "gfm"; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/PandocNet/Input/HaddockIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.haskell.org/haddock/doc/html/ch03s08.html 5 | /// 6 | public class HaddockIn : 7 | InOptions 8 | { 9 | protected override string Format => "haddock"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/HaskellIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class HaskellIn : 4 | InOptions 5 | { 6 | protected override string Format => "native"; 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/HtmlIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class HtmlIn : 4 | InOptions 5 | { 6 | protected override string Format => "html"; 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/InOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public abstract class InOptions 4 | { 5 | /// 6 | /// Shift heading levels by a positive or negative integer 7 | /// https://pandoc.org/MANUAL.html#option--shift-heading-level-by 8 | /// 9 | public int ShiftHeadingLevelBy { get; set; } 10 | /// 11 | /// Specify the number of spaces per tab (default is 4). 12 | /// https://pandoc.org/MANUAL.html#option--tab-stop 13 | /// 14 | public int? TabStop { get; set; } 15 | /// 16 | /// Specify classes to use for indented code blocks 17 | /// https://pandoc.org/MANUAL.html#option--indented-code-classes 18 | /// 19 | public IList? IndentedCodeClasses { get; set; } 20 | /// 21 | /// Parse each file individually before combining for multifile documents 22 | /// https://pandoc.org/MANUAL.html#option--file-scope 23 | /// 24 | public bool FileScope { get; set; } 25 | /// 26 | /// Preserve tabs instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) 27 | /// https://pandoc.org/MANUAL.html#option--preserve-tabs 28 | /// 29 | public bool PreserveTabs { get; set; } 30 | /// 31 | /// Specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written. The executable should read JSON from stdin and write JSON to stdout 32 | /// https://pandoc.org/MANUAL.html#option--filter 33 | /// 34 | public string? Filter { get; set; } 35 | /// 36 | /// Transform the document in a similar fashion as JSON filters (see --filter), but use pandoc’s built-in Lua filtering system. 37 | /// https://pandoc.org/MANUAL.html#option--lua-filter 38 | /// 39 | public string? LuaFilter { get; set; } 40 | //TODO:--metadata 41 | /// 42 | /// Set the metadata field KEY to the value VAL. A value specified on the command line overrides a value specified in the document using YAML metadata blocks. Values will be parsed as YAML boolean or string values. If no value is specified, the value will be treated as Boolean true. 43 | /// https://pandoc.org/MANUAL.html#option--metadata 44 | /// 45 | public string? Metadata { get; set; } 46 | /// 47 | /// Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. 48 | /// https://pandoc.org/MANUAL.html#option--extract-media 49 | /// 50 | public string? ExtractMedia{ get; set; } 51 | /// 52 | /// Specifies a custom abbreviations file, with abbreviations one to a line. 53 | /// https://pandoc.org/MANUAL.html#option--abbreviations 54 | /// 55 | public string? Abbreviations{ get; set; } 56 | 57 | protected abstract string Format { get; } 58 | 59 | public virtual IEnumerable GetArguments() 60 | { 61 | yield return $"--from={Format}"; 62 | 63 | if (ShiftHeadingLevelBy != 0) 64 | { 65 | yield return $"--shift-heading-level-by={ShiftHeadingLevelBy}"; 66 | } 67 | 68 | if (IndentedCodeClasses != null) 69 | { 70 | yield return $"--indented-code-classes={string.Join(",", IndentedCodeClasses)}"; 71 | } 72 | 73 | if (FileScope) 74 | { 75 | yield return "file-scope"; 76 | } 77 | 78 | if (Filter != null) 79 | { 80 | yield return $"--filter={Filter}"; 81 | } 82 | 83 | if (LuaFilter != null) 84 | { 85 | yield return $"--lua-filter={LuaFilter}"; 86 | } 87 | 88 | if (Metadata != null) 89 | { 90 | yield return $"--metadata-file={Metadata}"; 91 | } 92 | 93 | if (PreserveTabs) 94 | { 95 | yield return "--preserve-tabs"; 96 | } 97 | 98 | if (TabStop != null) 99 | { 100 | yield return $"--tab-stop={TabStop}"; 101 | } 102 | 103 | if (ExtractMedia != null) 104 | { 105 | yield return $"--extract-media={ExtractMedia}"; 106 | } 107 | 108 | if (Abbreviations != null) 109 | { 110 | yield return $"--abbreviations={Abbreviations}"; 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/JatsIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://jats.nlm.nih.gov/ 5 | /// 6 | public class JatsIn : 7 | InOptions 8 | { 9 | protected override string Format => "jats"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/JiraIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all 5 | /// 6 | public class JiraIn : 7 | InOptions 8 | { 9 | protected override string Format => "jira"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/JsonIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class JsonIn : 4 | InOptions 5 | { 6 | protected override string Format => "json"; 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/JupyterIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://nbformat.readthedocs.io/en/latest/ 5 | /// 6 | public class JupyterIn : 7 | InOptions 8 | { 9 | protected override string Format => "ipynb"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/LaTexIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.latex-project.org/ 5 | /// 6 | public class LaTexIn : 7 | InOptions 8 | { 9 | /// 10 | /// Specify a default extension to use when image paths/URLs have no extension 11 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 12 | /// 13 | public string? DefaultImageExtension { get; set; } 14 | 15 | public override IEnumerable GetArguments() 16 | { 17 | foreach (var argument in base.GetArguments()) 18 | { 19 | yield return argument; 20 | } 21 | 22 | if (DefaultImageExtension != null) 23 | { 24 | yield return $"--default-image-extension={DefaultImageExtension}"; 25 | } 26 | } 27 | 28 | protected override string Format => "latex"; 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Markdown/CommonMarkIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://commonmark.org/ 5 | /// 6 | public class CommonMarkIn : 7 | InOptions 8 | { 9 | protected override string Format => "commonmark"; 10 | 11 | /// 12 | /// Specify a default extension to use when image paths/URLs have no extension 13 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 14 | /// 15 | public string? DefaultImageExtension { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (DefaultImageExtension != null) 25 | { 26 | yield return $"--default-image-extension={DefaultImageExtension}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Markdown/CommonMarkXIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://commonmark.org/ 5 | /// 6 | public class CommonMarkXIn : 7 | InOptions 8 | { 9 | protected override string Format => "commonmark_x"; 10 | 11 | /// 12 | /// Specify a default extension to use when image paths/URLs have no extension 13 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 14 | /// 15 | public string? DefaultImageExtension { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (DefaultImageExtension != null) 25 | { 26 | yield return $"--default-image-extension={DefaultImageExtension}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Markdown/MdStrictIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://daringfireball.net/projects/markdown/ 5 | /// 6 | public class MdStrictIn : 7 | InOptions 8 | { 9 | protected override string Format => "markdown_strict"; 10 | 11 | /// 12 | /// Specify a default extension to use when image paths/URLs have no extension 13 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 14 | /// 15 | public string? DefaultImageExtension { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (DefaultImageExtension != null) 25 | { 26 | yield return $"--default-image-extension={DefaultImageExtension}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Markdown/MultiMdIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://fletcherpenney.net/multimarkdown/ 5 | /// 6 | public class MultiMdIn : 7 | InOptions 8 | { 9 | protected override string Format => "markdown_mmd"; 10 | 11 | /// 12 | /// Specify a default extension to use when image paths/URLs have no extension 13 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 14 | /// 15 | public string? DefaultImageExtension { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (DefaultImageExtension != null) 25 | { 26 | yield return $"--default-image-extension={DefaultImageExtension}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Markdown/PandocMdIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://pandoc.org/MANUAL.html#pandocs-markdown 5 | /// 6 | public class PandocMdIn : 7 | InOptions 8 | { 9 | protected override string Format => "markdown"; 10 | 11 | /// 12 | /// Specify a default extension to use when image paths/URLs have no extension 13 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 14 | /// 15 | public string? DefaultImageExtension { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (DefaultImageExtension != null) 25 | { 26 | yield return $"--default-image-extension={DefaultImageExtension}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/Markdown/PhpMdExtraIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://michelf.ca/projects/php-markdown/extra/ 5 | /// 6 | public class PhpMdExtraIn : 7 | InOptions 8 | { 9 | protected override string Format => "markdown_phpextra"; 10 | 11 | /// 12 | /// Specify a default extension to use when image paths/URLs have no extension 13 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 14 | /// 15 | public string? DefaultImageExtension { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (DefaultImageExtension != null) 25 | { 26 | yield return $"--default-image-extension={DefaultImageExtension}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/MediaWikiIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.mediawiki.org/wiki/Help:Formatting 5 | /// 6 | public class MediaWikiIn : 7 | InOptions 8 | { 9 | protected override string Format => "mediawiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/MuseIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://amusewiki.org/library/manual 5 | /// 6 | public class MuseIn : 7 | InOptions 8 | { 9 | protected override string Format => "muse"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/OdtIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/OpenDocument 5 | /// 6 | public class OdtIn : 7 | InOptions 8 | { 9 | protected override string Format => "odt"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/OpmlIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://opml.org/spec2.opml 5 | /// 6 | public class OpmlIn : 7 | InOptions 8 | { 9 | protected override string Format => "opml"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/RoffManIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://man.cx/groff_man(7) 5 | /// 6 | public class RoffManIn : 7 | InOptions 8 | { 9 | protected override string Format => "man"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/RstIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://docutils.sourceforge.io/docs/ref/rst/introduction.html 5 | /// 6 | public class RstIn : 7 | InOptions 8 | { 9 | protected override string Format => "rst"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/RtfIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/Rich_Text_Format 5 | /// 6 | public class RtfIn : 7 | InOptions 8 | { 9 | protected override string Format => "rtf"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/T2tIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://txt2tags.org/ 5 | /// 6 | public class T2tIn : 7 | InOptions 8 | { 9 | protected override string Format => "t2t"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/TWikiIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules 5 | /// 6 | public class TWikiIn : 7 | InOptions 8 | { 9 | protected override string Format => "twiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/TextileIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.promptworks.com/textile 5 | /// 6 | public class TextileIn : 7 | InOptions 8 | { 9 | protected override string Format => "textile"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/TikiWikiIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules 5 | /// 6 | public class TikiWikiIn : 7 | InOptions 8 | { 9 | protected override string Format => "tikiwiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/TrackChanges.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public enum TrackChanges 4 | { 5 | Accept, 6 | Reject, 7 | All 8 | } -------------------------------------------------------------------------------- /src/PandocNet/Input/VimWikiIn.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://vimwiki.github.io/ 5 | /// 6 | public class VimWikiIn : 7 | InOptions 8 | { 9 | protected override string Format => "vimwiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Options.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class Options 4 | { 5 | /// 6 | /// Specify the user data directory to search for pandoc data files. If this option is not specified, the default user data directory will be used. 7 | /// https://pandoc.org/MANUAL.html#option--data-dir 8 | /// 9 | public string? DataDirectory { get; set; } 10 | 11 | /// 12 | /// Specify a set of default option settings. FILE is a YAML file whose fields correspond to command-line option settings. 13 | /// https://pandoc.org/MANUAL.html#option--defaults 14 | /// 15 | public string? DefaultsFile { get; set; } 16 | 17 | /// 18 | /// Write log messages in machine-readable JSON format to FILE. All messages above DEBUG level will be written, regardless of verbosity settings. 19 | /// https://pandoc.org/MANUAL.html#option--log 20 | /// 21 | public string? LogFile { get; set; } 22 | 23 | public static IEnumerable GetArguments(Options? options) 24 | { 25 | if (options == null) 26 | { 27 | yield break; 28 | } 29 | 30 | if (options.DataDirectory != null) 31 | { 32 | yield return $"--data-dir={options.DataDirectory}"; 33 | } 34 | 35 | if (options.DefaultsFile != null) 36 | { 37 | yield return $"--defaults={options.DefaultsFile}"; 38 | } 39 | 40 | if (options.LogFile != null) 41 | { 42 | yield return $"--log={options.LogFile}"; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/PandocNet/Output.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class Output 4 | { 5 | string? file; 6 | StringBuilder? stringBuilder; 7 | Stream? stream; 8 | 9 | public Output(string file) => 10 | this.file = file; 11 | 12 | public Output(Stream stream) => 13 | this.stream = stream; 14 | 15 | public Output(StringBuilder stringBuilder) => 16 | this.stringBuilder = stringBuilder; 17 | 18 | public static implicit operator Output(string value) => new(value); 19 | public static implicit operator Output(Stream stream) => new(stream); 20 | public static implicit operator Output(StringBuilder stringBuilder) => new(stringBuilder); 21 | 22 | public PipeTarget GetPipeTarget() 23 | { 24 | if (stringBuilder != null) 25 | { 26 | return PipeTarget.ToStringBuilder(stringBuilder); 27 | } 28 | 29 | if (file != null) 30 | { 31 | File.Delete(file); 32 | return PipeTarget.ToFile(file); 33 | } 34 | 35 | if (stream != null) 36 | { 37 | return PipeTarget.ToStream(stream); 38 | } 39 | 40 | throw new("Unknown output"); 41 | } 42 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/AsciiDocOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/AsciiDoc 5 | /// 6 | public class AsciiDocOut : 7 | OutOptions 8 | { 9 | public override string Format => "asciidoc"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/AsciiDoctorOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://asciidoctor.org/ 5 | /// 6 | public class AsciiDoctorOut : 7 | OutOptions 8 | { 9 | public override string Format => "asciidoctor"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/BibLaTeXOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://ctan.org/pkg/biblatex 5 | /// 6 | public class BibLaTeXOut : 7 | OutOptions 8 | { 9 | public override string Format => "biblatex"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/BibTeXOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://ctan.org/pkg/bibtex 5 | /// 6 | public class BibTeXOut : 7 | OutOptions 8 | { 9 | public override string Format => "bibtex"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/ConTeXtOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.contextgarden.net/ 5 | /// 6 | public class ConTeXtOut : 7 | OutOptions 8 | { 9 | public override string Format => "context"; 10 | 11 | /// 12 | /// Number section headings 13 | /// https://pandoc.org/MANUAL.html#option--number-sections 14 | /// 15 | public bool NumberSections { get; set; } 16 | /// 17 | /// Treat top-level headings as the given division output.The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type 18 | /// https://pandoc.org/MANUAL.html#option--top-level-division 19 | /// 20 | public TopLevelDivision? TopLevelDivision { get; set; } 21 | 22 | public override IEnumerable GetArguments() 23 | { 24 | foreach (var argument in base.GetArguments()) 25 | { 26 | yield return argument; 27 | } 28 | 29 | if (NumberSections) 30 | { 31 | yield return "--number-sections"; 32 | } 33 | 34 | if (TopLevelDivision != null) 35 | { 36 | yield return $"--top-level-division={TopLevelDivision}"; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/CslJsonOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html 5 | /// 6 | public class CslJsonOut : 7 | OutOptions 8 | { 9 | public override string Format => "csljson"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/DocBook4Out.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://docbook.org/ 5 | /// 6 | public class DocBook4Out : 7 | OutOptions 8 | { 9 | public override string Format => "docbook4"; 10 | 11 | /// 12 | /// Treat top-level headings as the given division output.The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type 13 | /// https://pandoc.org/MANUAL.html#option--top-level-division 14 | /// 15 | public TopLevelDivision? TopLevelDivision { get; set; } 16 | /// 17 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 18 | /// https://pandoc.org/MANUAL.html#option--id-prefix 19 | /// 20 | public string? IdPrefix { get; set; } 21 | 22 | public override IEnumerable GetArguments() 23 | { 24 | foreach (var argument in base.GetArguments()) 25 | { 26 | yield return argument; 27 | } 28 | 29 | if (IdPrefix != null) 30 | { 31 | yield return $"--id-prefix={IdPrefix}"; 32 | } 33 | 34 | if (TopLevelDivision != null) 35 | { 36 | yield return $"--top-level-division={TopLevelDivision}"; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/DocBook5Out.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://docbook.org/ 5 | /// 6 | public class DocBook5Out : 7 | OutOptions 8 | { 9 | public override string Format => "docbook5"; 10 | 11 | /// 12 | /// Treat top-level headings as the given division output.The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type 13 | /// https://pandoc.org/MANUAL.html#option--top-level-division 14 | /// 15 | public TopLevelDivision? TopLevelDivision { get; set; } 16 | /// 17 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 18 | /// https://pandoc.org/MANUAL.html#option--id-prefix 19 | /// 20 | public string? IdPrefix { get; set; } 21 | 22 | public override IEnumerable GetArguments() 23 | { 24 | foreach (var argument in base.GetArguments()) 25 | { 26 | yield return argument; 27 | } 28 | 29 | if (TopLevelDivision != null) 30 | { 31 | yield return $"--top-level-division={TopLevelDivision}"; 32 | } 33 | if (IdPrefix != null) 34 | { 35 | yield return $"--id-prefix={IdPrefix}"; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/DocxOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/Office_Open_XML 5 | /// 6 | public class DocxOut : 7 | OutOptions 8 | { 9 | public override string Format => "docx"; 10 | 11 | /// 12 | /// Number section headings 13 | /// https://pandoc.org/MANUAL.html#option--number-sections 14 | /// 15 | public bool NumberSections { get; set; } 16 | 17 | /// 18 | /// Use the specified file as a style reference in producing 19 | /// https://pandoc.org/MANUAL.html#option--reference-doc 20 | /// 21 | public string? ReferenceDoc { get; set; } 22 | 23 | public override IEnumerable GetArguments() 24 | { 25 | foreach (var argument in base.GetArguments()) 26 | { 27 | yield return argument; 28 | } 29 | 30 | if (NumberSections) 31 | { 32 | yield return "--number-sections"; 33 | } 34 | 35 | if (ReferenceDoc != null) 36 | { 37 | yield return $"--reference-doc={ReferenceDoc}"; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/DokuWikiOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.dokuwiki.org/dokuwiki 5 | /// 6 | public class DokuWikiOut : 7 | OutOptions 8 | { 9 | public override string Format => "dokuwiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/EmacsOrgOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://orgmode.org/ 5 | /// 6 | public class EmacsOrgOut : 7 | OutOptions 8 | { 9 | public override string Format => "org"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Eol.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public enum Eol 4 | { 5 | Crlf, 6 | Lf, 7 | Native 8 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Epub2Out.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://pandoc.org/MANUAL.html 5 | /// 6 | public class Epub2Out : 7 | OutOptions 8 | { 9 | public override string Format => "epub2"; 10 | 11 | /// 12 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 13 | /// https://pandoc.org/MANUAL.html#option--reference-location 14 | /// 15 | public ReferenceLocation? ReferenceLocation { get; set; } 16 | /// 17 | /// Number section headings 18 | /// https://pandoc.org/MANUAL.html#option--number-sections 19 | /// 20 | public bool NumberSections { get; set; } 21 | /// 22 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 23 | /// https://pandoc.org/MANUAL.html#option--css 24 | /// 25 | public string? Css { get; set; } 26 | /// 27 | /// Use the specified image as the EPUB cover 28 | /// https://pandoc.org/MANUAL.html#option--epub-cover-image 29 | /// 30 | public string? CoverImage { get; set; } 31 | /// 32 | /// Look in the specified XML file for metadata for the EPUB. 33 | /// https://pandoc.org/MANUAL.html#option--epub-metadata 34 | /// 35 | public string? Metadata { get; set; } 36 | /// 37 | /// Specify the subdirectory in the OCF container that is to hold the EPUB-specific contents 38 | /// https://pandoc.org/MANUAL.html#option--epub-subdirectory 39 | /// 40 | public string? SubDirectory { get; set; } 41 | /// 42 | /// Embed the specified font in the EPUB. This option can be repeated to embed multiple fonts 43 | /// https://pandoc.org/MANUAL.html#option--epub-embed-font 44 | /// 45 | public string? EmbedFont { get; set; } 46 | /// 47 | /// Specify the heading level at which to split the EPUB into separate “chapter” files 48 | /// https://pandoc.org/MANUAL.html#option--epub-chapter-level 49 | /// 50 | public int? ChapterLevel { get; set; } 51 | 52 | public override IEnumerable GetArguments() 53 | { 54 | foreach (var argument in base.GetArguments()) 55 | { 56 | yield return argument; 57 | } 58 | 59 | if (ReferenceLocation != null) 60 | { 61 | yield return $"--reference-location={ReferenceLocation}"; 62 | } 63 | 64 | if (NumberSections) 65 | { 66 | yield return "--number-sections"; 67 | } 68 | if (Css != null) 69 | { 70 | yield return $"--css={Css}"; 71 | } 72 | if (CoverImage != null) 73 | { 74 | yield return $"--epub-cover-image={CoverImage}"; 75 | } 76 | if (Metadata != null) 77 | { 78 | yield return $"--epub-metadata={Metadata}"; 79 | } 80 | if (EmbedFont != null) 81 | { 82 | yield return $"--epub-embed-font={EmbedFont}"; 83 | } 84 | if (ChapterLevel != null) 85 | { 86 | yield return $"--epub-chapter-level={ChapterLevel}"; 87 | } 88 | if (SubDirectory != null) 89 | { 90 | yield return $"--epub-subdirectory={SubDirectory}"; 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Epub3Out.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://pandoc.org/MANUAL.html 5 | /// 6 | public class Epub3Out : 7 | OutOptions 8 | { 9 | public override string Format => "epub3"; 10 | 11 | /// 12 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 13 | /// https://pandoc.org/MANUAL.html#option--reference-location 14 | /// 15 | public ReferenceLocation? ReferenceLocation { get; set; } 16 | 17 | /// 18 | /// Number section headings 19 | /// https://pandoc.org/MANUAL.html#option--number-sections 20 | /// 21 | public bool NumberSections { get; set; } 22 | 23 | /// 24 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 25 | /// https://pandoc.org/MANUAL.html#option--css 26 | /// 27 | public string? Css { get; set; } 28 | 29 | /// 30 | /// Use the specified image as the EPUB cover 31 | /// https://pandoc.org/MANUAL.html#option--epub-cover-image 32 | /// 33 | public string? CoverImage { get; set; } 34 | 35 | /// 36 | /// Look in the specified XML file for metadata for the EPUB. 37 | /// https://pandoc.org/MANUAL.html#option--epub-metadata 38 | /// 39 | public string? Metadata { get; set; } 40 | 41 | /// 42 | /// Specify the subdirectory in the OCF container that is to hold the EPUB-specific contents 43 | /// https://pandoc.org/MANUAL.html#option--epub-subdirectory 44 | /// 45 | public string? SubDirectory { get; set; } 46 | 47 | /// 48 | /// Embed the specified font in the EPUB. This option can be repeated to embed multiple fonts 49 | /// https://pandoc.org/MANUAL.html#option--epub-embed-font 50 | /// 51 | public string? EmbedFont { get; set; } 52 | 53 | /// 54 | /// Specify the heading level at which to split the EPUB into separate “chapter” files 55 | /// https://pandoc.org/MANUAL.html#option--epub-chapter-level 56 | /// 57 | public int? ChapterLevel { get; set; } 58 | 59 | public override IEnumerable GetArguments() 60 | { 61 | foreach (var argument in base.GetArguments()) 62 | { 63 | yield return argument; 64 | } 65 | 66 | if (ReferenceLocation != null) 67 | { 68 | yield return $"--reference-location={ReferenceLocation}"; 69 | } 70 | 71 | if (NumberSections) 72 | { 73 | yield return "--number-sections"; 74 | } 75 | 76 | if (Css != null) 77 | { 78 | yield return $"--css={Css}"; 79 | } 80 | 81 | if (CoverImage != null) 82 | { 83 | yield return $"--epub-cover-image={CoverImage}"; 84 | } 85 | 86 | if (Metadata != null) 87 | { 88 | yield return $"--epub-metadata={Metadata}"; 89 | } 90 | 91 | if (EmbedFont != null) 92 | { 93 | yield return $"--epub-embed-font={EmbedFont}"; 94 | } 95 | 96 | if (ChapterLevel != null) 97 | { 98 | yield return $"--epub-chapter-level={ChapterLevel}"; 99 | } 100 | 101 | if (SubDirectory != null) 102 | { 103 | yield return $"--epub-subdirectory={SubDirectory}"; 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Fb2Out.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1 5 | /// 6 | public class Fb2Out : 7 | OutOptions 8 | { 9 | public override string Format => "fb2"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/HaddockOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.haskell.org/haddock/doc/html/ch03s08.html 5 | /// 6 | public class HaddockOut : 7 | OutOptions 8 | { 9 | public override string Format => "haddock"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/HaskellOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class HaskellOut : 4 | OutOptions 5 | { 6 | public override string Format => "native"; 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/HtmlOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class HtmlOut : 4 | OutOptions 5 | { 6 | public override string Format => "html"; 7 | 8 | /// 9 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 10 | /// https://pandoc.org/MANUAL.html#option--self-contained 11 | /// 12 | public bool SelfContained { get; set; } 13 | 14 | /// 15 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 16 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 17 | /// 18 | public bool HtmlQTags { get; set; } 19 | 20 | /// 21 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 22 | /// https://pandoc.org/MANUAL.html#option--section-divs 23 | /// 24 | public bool SectionDivs { get; set; } 25 | 26 | /// 27 | /// Use only ASCII characters in output 28 | /// https://pandoc.org/MANUAL.html#option--ascii 29 | /// 30 | public bool Ascii { get; set; } 31 | 32 | /// 33 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 34 | /// https://pandoc.org/MANUAL.html#option--reference-location 35 | /// 36 | public ReferenceLocation? ReferenceLocation { get; set; } 37 | 38 | /// 39 | /// Number section headings 40 | /// https://pandoc.org/MANUAL.html#option--number-sections 41 | /// 42 | public bool NumberSections { get; set; } 43 | 44 | /// 45 | /// Number section headings 46 | /// https://pandoc.org/MANUAL.html#option--number-sections 47 | /// 48 | public IList? NumberOffsets { get; set; } 49 | 50 | /// 51 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 52 | /// https://pandoc.org/MANUAL.html#option--id-prefix 53 | /// 54 | public string? IdPrefix { get; set; } 55 | 56 | /// 57 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 58 | /// https://pandoc.org/MANUAL.html#option--css 59 | /// 60 | public string? Css { get; set; } 61 | 62 | /// 63 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 64 | /// https://pandoc.org/MANUAL.html#option--title-prefix 65 | /// 66 | public string? TitlePrefix { get; set; } 67 | 68 | public override IEnumerable GetArguments() 69 | { 70 | foreach (var argument in base.GetArguments()) 71 | { 72 | yield return argument; 73 | } 74 | 75 | if (SelfContained) 76 | { 77 | yield return "--self-contained"; 78 | } 79 | 80 | if (Ascii) 81 | { 82 | yield return "--ascii"; 83 | } 84 | 85 | if (HtmlQTags) 86 | { 87 | yield return "--html-q-tags"; 88 | } 89 | 90 | if (ReferenceLocation != null) 91 | { 92 | yield return $"--reference-location={ReferenceLocation}"; 93 | } 94 | 95 | if (NumberSections) 96 | { 97 | yield return "--number-sections"; 98 | } 99 | 100 | if (NumberOffsets != null) 101 | { 102 | yield return $"--number-offset={string.Join(",", NumberOffsets)}"; 103 | } 104 | 105 | if (SectionDivs) 106 | { 107 | yield return "--section-divs"; 108 | } 109 | 110 | if (IdPrefix != null) 111 | { 112 | yield return $"--id-prefix={IdPrefix}"; 113 | } 114 | 115 | if (Css != null) 116 | { 117 | yield return $"--css={Css}"; 118 | } 119 | 120 | if (TitlePrefix != null) 121 | { 122 | yield return $"--title-prefix={TitlePrefix}"; 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/IcmlOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf 5 | /// 6 | public class IcmlOut : 7 | OutOptions 8 | { 9 | public override string Format => "icml"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JatsArchivingOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://jats.nlm.nih.gov/ 5 | /// 6 | public class JatsArchivingOut : 7 | OutOptions 8 | { 9 | public override string Format => "jats_archiving"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (Ascii) 25 | { 26 | yield return "--ascii"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JatsArticleAuthoringOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://jats.nlm.nih.gov/ 5 | /// 6 | public class JatsArticleAuthoringOut : 7 | OutOptions 8 | { 9 | public override string Format => "jats_articleauthoring"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (Ascii) 25 | { 26 | yield return "--ascii"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JatsPublishingOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://jats.nlm.nih.gov/ 5 | /// 6 | public class JatsPublishingOut : 7 | OutOptions 8 | { 9 | public override string Format => "jats_publishing"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (Ascii) 25 | { 26 | yield return "--ascii"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JiraOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all 5 | /// 6 | public class JiraOut : 7 | OutOptions 8 | { 9 | public override string Format => "jira"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JsonOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class JsonOut : 4 | OutOptions 5 | { 6 | public override string Format => "json"; 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JupyterCellOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public enum JupyterCellOutput 4 | { 5 | All, 6 | None, 7 | Best 8 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/JupyterOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://nbformat.readthedocs.io/en/latest/ 5 | /// 6 | public class JupyterOut : 7 | OutOptions 8 | { 9 | public override string Format => "ipynb"; 10 | 11 | /// 12 | /// Determines how ipynb output cells are treated. all means that all of the data formats included in the original are preserved 13 | /// https://pandoc.org/MANUAL.html#option--ipynb-output 14 | /// 15 | public JupyterCellOutput? CellOutput { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (CellOutput != null) 25 | { 26 | yield return $"--ipynb-output={CellOutput}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/LaTeXOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://pandoc.org/MANUAL.html 5 | /// 6 | public class LaTeXOut : 7 | OutOptions 8 | { 9 | public override string Format => "latex"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | 17 | /// 18 | /// Treat top-level headings as the given division output.The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type 19 | /// https://pandoc.org/MANUAL.html#option--top-level-division 20 | /// 21 | public TopLevelDivision? TopLevelDivision { get; set; } 22 | 23 | /// 24 | /// Number section headings 25 | /// https://pandoc.org/MANUAL.html#option--number-sections 26 | /// 27 | public bool NumberSections { get; set; } 28 | 29 | /// 30 | /// Number section headings 31 | /// https://pandoc.org/MANUAL.html#option--number-sections 32 | /// 33 | public bool Listings { get; set; } 34 | 35 | public override IEnumerable GetArguments() 36 | { 37 | foreach (var argument in base.GetArguments()) 38 | { 39 | yield return argument; 40 | } 41 | 42 | if (Ascii) 43 | { 44 | yield return "--ascii"; 45 | } 46 | 47 | if (TopLevelDivision != null) 48 | { 49 | yield return $"--top-level-division={TopLevelDivision}"; 50 | } 51 | 52 | if (NumberSections) 53 | { 54 | yield return "--number-sections"; 55 | } 56 | 57 | if (Listings) 58 | { 59 | yield return "--listings"; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/CommonMarkOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://commonmark.org/ 5 | /// 6 | public class CommonMarkOut : 7 | OutOptions 8 | { 9 | public override string Format => "commonmark"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | if (ReferenceLinks) 44 | { 45 | yield return "--reference-links"; 46 | } 47 | if (ReferenceLocation != null) 48 | { 49 | yield return $"--reference-location={ReferenceLocation}"; 50 | } 51 | if (MarkdownHeadings != null) 52 | { 53 | yield return $"--markdown-headings={MarkdownHeadings}"; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/CommonMarkXOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://commonmark.org/ 5 | /// 6 | public class CommonMarkXOut : 7 | OutOptions 8 | { 9 | public override string Format => "commonmark_x"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | if (ReferenceLinks) 44 | { 45 | yield return "--reference-links"; 46 | } 47 | if (ReferenceLocation != null) 48 | { 49 | yield return $"--reference-location={ReferenceLocation}"; 50 | } 51 | if (MarkdownHeadings != null) 52 | { 53 | yield return $"--markdown-headings={MarkdownHeadings}"; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/GhMdOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://help.github.com/articles/github-flavored-markdown/ 5 | /// 6 | public class GhMdOut : 7 | OutOptions 8 | { 9 | public override string Format => "gfm"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | if (ReferenceLinks) 44 | { 45 | yield return "--reference-links"; 46 | } 47 | if (ReferenceLocation != null) 48 | { 49 | yield return $"--reference-location={ReferenceLocation}"; 50 | } 51 | if (MarkdownHeadings != null) 52 | { 53 | yield return $"--markdown-headings={MarkdownHeadings}"; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/MarkdownHeadings.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public enum MarkdownHeadings 4 | { 5 | Setext, 6 | Atx 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/MdStrictOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://daringfireball.net/projects/markdown/ 5 | /// 6 | public class MdStrictOut : 7 | OutOptions 8 | { 9 | public override string Format => "markdown_strict"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | if (ReferenceLinks) 44 | { 45 | yield return "--reference-links"; 46 | } 47 | if (ReferenceLocation != null) 48 | { 49 | yield return $"--reference-location={ReferenceLocation}"; 50 | } 51 | if (MarkdownHeadings != null) 52 | { 53 | yield return $"--markdown-headings={MarkdownHeadings}"; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/MultiMdOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://fletcherpenney.net/multimarkdown/ 5 | /// 6 | public class MultiMdOut : 7 | OutOptions 8 | { 9 | public override string Format => "markdown_mmd"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | if (ReferenceLinks) 44 | { 45 | yield return "--reference-links"; 46 | } 47 | if (ReferenceLocation != null) 48 | { 49 | yield return $"--reference-location={ReferenceLocation}"; 50 | } 51 | if (MarkdownHeadings != null) 52 | { 53 | yield return $"--markdown-headings={MarkdownHeadings}"; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/PandocMdOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://pandoc.org/MANUAL.html#pandocs-markdown 5 | /// 6 | public class PandocMdOut : 7 | OutOptions 8 | { 9 | public override string Format => "markdown"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | 44 | if (ReferenceLinks) 45 | { 46 | yield return "--reference-links"; 47 | } 48 | if (ReferenceLocation != null) 49 | { 50 | yield return $"--reference-location={ReferenceLocation}"; 51 | } 52 | if (MarkdownHeadings != null) 53 | { 54 | yield return $"--markdown-headings={MarkdownHeadings}"; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Markdown/PhpMdExtraOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://michelf.ca/projects/php-markdown/extra/ 5 | /// 6 | public class PhpMdExtraOut : 7 | OutOptions 8 | { 9 | public override string Format => "markdown_phpextra"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | /// 17 | /// Use reference-style links, rather than inline links 18 | /// https://pandoc.org/MANUAL.html#option--reference-links 19 | /// 20 | public bool ReferenceLinks { get; set; } 21 | /// 22 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 23 | /// https://pandoc.org/MANUAL.html#option--reference-location 24 | /// 25 | public ReferenceLocation? ReferenceLocation { get; set; } 26 | /// 27 | /// Specify whether to use ATX-style (#-prefixed) or Setext-style (underlined) headings for level 1 and 2 headings in Markdown output 28 | /// https://pandoc.org/MANUAL.html#option--markdown-headings 29 | /// 30 | public MarkdownHeadings? MarkdownHeadings { get; set; } 31 | 32 | public override IEnumerable GetArguments() 33 | { 34 | foreach (var argument in base.GetArguments()) 35 | { 36 | yield return argument; 37 | } 38 | 39 | if (Ascii) 40 | { 41 | yield return "--ascii"; 42 | } 43 | 44 | if (ReferenceLinks) 45 | { 46 | yield return "--reference-links"; 47 | } 48 | if (ReferenceLocation != null) 49 | { 50 | yield return $"--reference-location={ReferenceLocation}"; 51 | } 52 | if (MarkdownHeadings != null) 53 | { 54 | yield return $"--markdown-headings={MarkdownHeadings}"; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/MediaWikiOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.mediawiki.org/wiki/Help:Formatting 5 | /// 6 | public class MediaWikiOut : 7 | OutOptions 8 | { 9 | public override string Format => "mediawiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/MuseOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://amusewiki.org/library/manual 5 | /// 6 | public class MuseOut : 7 | OutOptions 8 | { 9 | public override string Format => "muse"; 10 | 11 | /// 12 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 13 | /// https://pandoc.org/MANUAL.html#option--reference-location 14 | /// 15 | public ReferenceLocation? ReferenceLocation { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (ReferenceLocation != null) 25 | { 26 | yield return $"--reference-location={ReferenceLocation}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/OdtOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/OpenDocument 5 | /// 6 | public class OdtOut : 7 | OutOptions 8 | { 9 | public override string Format => "odt"; 10 | 11 | /// 12 | /// Use the specified file as a style reference in producing 13 | /// https://pandoc.org/MANUAL.html#option--reference-doc 14 | /// 15 | public string? ReferenceDoc { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (ReferenceDoc != null) 25 | { 26 | yield return $"--reference-doc={ReferenceDoc}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/OpenDocumentOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://opendocument.xml.org/ 5 | /// 6 | public class OpenDocumentOut : 7 | OutOptions 8 | { 9 | public override string Format => "opendocument"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/OpmlOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// http://dev.opml.org/spec2.html 5 | /// 6 | public class OpmlOut : 7 | OutOptions 8 | { 9 | public override string Format => "opml"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/OutOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Pandoc; 4 | 5 | public abstract class OutOptions 6 | { 7 | public abstract string Format { get; } 8 | 9 | public bool Standalone { get; set; } 10 | public bool StripComments { get; set; } 11 | public bool NoHighlight { get; set; } 12 | public bool NoCheckCertificate { get; set; } 13 | public string? HighlightStyle { get; set; } 14 | public string? SyntaxDefinition { get; set; } 15 | public string? IncludeInHeader { get; set; } 16 | public string? IncludeBeforeBody { get; set; } 17 | public string? IncludeAfterBody { get; set; } 18 | public IList? ResourcePaths { get; set; } 19 | public bool Sandbox { get; set; } 20 | public bool TableOfContents { get; set; } 21 | public int? TableOfContentsDepth { get; set; } 22 | public Eol? Eol { get; set; } 23 | public Wrap? Wrap { get; set; } 24 | public int? Dpi { get; set; } 25 | public int? Columns { get; set; } 26 | public string? Template { get; set; } 27 | 28 | //TODO: variables 29 | public virtual IEnumerable GetArguments() 30 | { 31 | yield return $"--to={Format}"; 32 | 33 | if (Standalone) 34 | { 35 | yield return "--standalone"; 36 | } 37 | 38 | if (Template != null) 39 | { 40 | yield return $"--template={Template}"; 41 | } 42 | 43 | if (Sandbox) 44 | { 45 | yield return "--sandbox"; 46 | } 47 | 48 | if (Eol != null) 49 | { 50 | yield return $"--eol={Eol.Value.ToString().ToLower()}"; 51 | } 52 | 53 | if (Wrap != null) 54 | { 55 | yield return $"--wrap={Wrap.Value.ToString().ToLower()}"; 56 | } 57 | 58 | if (Dpi != null) 59 | { 60 | yield return $"--dpi={Dpi}"; 61 | } 62 | if (Columns != null) 63 | { 64 | yield return $"--columns={Columns}"; 65 | } 66 | if (TableOfContents) 67 | { 68 | yield return "--table-of-contents"; 69 | } 70 | if (TableOfContentsDepth != null) 71 | { 72 | yield return $"--toc-depth={TableOfContentsDepth}"; 73 | } 74 | if (StripComments) 75 | { 76 | yield return "--strip-comments"; 77 | } 78 | if (NoHighlight) 79 | { 80 | yield return "--no-highlight"; 81 | } 82 | if (NoCheckCertificate) 83 | { 84 | yield return "--no-check-certificate"; 85 | } 86 | if (HighlightStyle != null) 87 | { 88 | yield return $"--highlight-style={HighlightStyle}"; 89 | } 90 | if (SyntaxDefinition != null) 91 | { 92 | yield return $"--syntax-definition={SyntaxDefinition}"; 93 | } 94 | if (IncludeInHeader != null) 95 | { 96 | yield return $"--include-in-header={IncludeInHeader}"; 97 | } 98 | if (IncludeBeforeBody != null) 99 | { 100 | yield return $"--include-before-body={IncludeBeforeBody}"; 101 | } 102 | if (IncludeAfterBody != null) 103 | { 104 | yield return $"--include-after-body={IncludeAfterBody}"; 105 | } 106 | //TODO: request-header 107 | 108 | if (ResourcePaths != null) 109 | { 110 | var split = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ";" : ":"; 111 | yield return $"--resource-path={string.Join(split, ResourcePaths)}"; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/PandocNet/Output/Pdf/PdfEngine.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public enum PdfEngine 4 | { 5 | PdfLatex, 6 | LuaLatex, 7 | XeLatex, 8 | LatexMk, 9 | Tectonic, 10 | WkHtmlToPdf, 11 | WeasyPrint, 12 | Prince, 13 | Context, 14 | PdfRoff 15 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Pdf/PdfOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.adobe.com/acrobat/about-adobe-pdf.html 5 | /// 6 | public class PdfOut : 7 | OutOptions 8 | { 9 | public override string Format => "pdf"; 10 | 11 | /// 12 | /// Specify the name of the engine to look for on the path. 13 | /// 14 | /// 15 | /// 'EnginePath' takes precedence over this property. 16 | /// 17 | public PdfEngine? Engine { get; set; } 18 | 19 | /// 20 | /// Specify the location of the engine. 21 | /// 22 | /// 23 | /// This takes precedence over the 'Engine' property. 24 | /// 25 | public string? EnginePath { get; set; } 26 | 27 | public override IEnumerable GetArguments() 28 | { 29 | foreach (var argument in base.GetArguments()) 30 | { 31 | yield return argument; 32 | } 33 | 34 | if (!string.IsNullOrEmpty(EnginePath)) 35 | { 36 | yield return $"--pdf-engine={EnginePath}"; 37 | } 38 | else if (Engine != null) 39 | { 40 | yield return $"--pdf-engine={Engine.Value.ToString().ToLower()}"; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/ReferenceLocation.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public enum ReferenceLocation 4 | { 5 | Block, 6 | Section, 7 | Document 8 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/RoffManOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://man.cx/groff_man(7) 5 | /// 6 | public class RoffManOut : 7 | OutOptions 8 | { 9 | public override string Format => "man"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/RoffMsOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://man.cx/groff_ms(7) 5 | /// 6 | public class RoffMsOut : 7 | OutOptions 8 | { 9 | public override string Format => "ms"; 10 | 11 | /// 12 | /// Use only ASCII characters in output 13 | /// https://pandoc.org/MANUAL.html#option--ascii 14 | /// 15 | public bool Ascii { get; set; } 16 | 17 | /// 18 | /// Number section headings 19 | /// https://pandoc.org/MANUAL.html#option--number-sections 20 | /// 21 | public bool NumberSections { get; set; } 22 | 23 | public override IEnumerable GetArguments() 24 | { 25 | foreach (var argument in base.GetArguments()) 26 | { 27 | yield return argument; 28 | } 29 | 30 | if (Ascii) 31 | { 32 | yield return "--ascii"; 33 | } 34 | 35 | if (NumberSections) 36 | { 37 | yield return "--number-sections"; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/RstOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://docutils.sourceforge.io/docs/ref/rst/introduction.html 5 | /// 6 | public class RstOut : 7 | OutOptions 8 | { 9 | public override string Format => "rst"; 10 | /// 11 | /// Use reference-style links, rather than inline links 12 | /// https://pandoc.org/MANUAL.html#option--reference-links 13 | /// 14 | public bool ReferenceLinks { get; set; } 15 | 16 | public override IEnumerable GetArguments() 17 | { 18 | foreach (var argument in base.GetArguments()) 19 | { 20 | yield return argument; 21 | } 22 | 23 | if (ReferenceLinks) 24 | { 25 | yield return "--reference-links"; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/RtfOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/Rich_Text_Format 5 | /// 6 | public class RtfOut : 7 | OutOptions 8 | { 9 | public override string Format => "rtf"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/BeamerOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://ctan.org/pkg/beamer 5 | /// 6 | public class BeamerOut : 7 | OutOptions 8 | { 9 | public override string Format => "beamer"; 10 | 11 | /// 12 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 13 | /// https://pandoc.org/MANUAL.html#option--self-contained 14 | /// 15 | public bool SelfContained { get; set; } 16 | /// 17 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 18 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 19 | /// 20 | public bool HtmlQTags { get; set; } 21 | /// 22 | /// Make list items in slide shows display incrementally (one by one). The default is for lists to be displayed all at once. 23 | /// https://pandoc.org/MANUAL.html#option--incremental 24 | /// 25 | public bool Incremental { get; set; } 26 | /// 27 | /// Specifies that headings with the specified level create slides 28 | /// https://pandoc.org/MANUAL.html#option--slide-level 29 | /// 30 | public int? SlideLevel { get; set; } 31 | /// 32 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 33 | /// https://pandoc.org/MANUAL.html#option--section-divs 34 | /// 35 | public bool SectionDivs { get; set; } 36 | /// 37 | /// Use only ASCII characters in output 38 | /// https://pandoc.org/MANUAL.html#option--ascii 39 | /// 40 | public bool Ascii { get; set; } 41 | /// 42 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 43 | /// https://pandoc.org/MANUAL.html#option--reference-location 44 | /// 45 | public ReferenceLocation? ReferenceLocation { get; set; } 46 | /// 47 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 48 | /// https://pandoc.org/MANUAL.html#option--id-prefix 49 | /// 50 | public string? IdPrefix { get; set; } 51 | /// 52 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 53 | /// https://pandoc.org/MANUAL.html#option--css 54 | /// 55 | public string? Css { get; set; } 56 | /// 57 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 58 | /// https://pandoc.org/MANUAL.html#option--title-prefix 59 | /// 60 | public string? TitlePrefix { get; set; } 61 | 62 | public override IEnumerable GetArguments() 63 | { 64 | foreach (var argument in base.GetArguments()) 65 | { 66 | yield return argument; 67 | } 68 | 69 | if (SelfContained) 70 | { 71 | yield return "--self-contained"; 72 | } 73 | 74 | if (Ascii) 75 | { 76 | yield return "--ascii"; 77 | } 78 | 79 | if (HtmlQTags) 80 | { 81 | yield return "--html-q-tags"; 82 | } 83 | if (ReferenceLocation != null) 84 | { 85 | yield return $"--reference-location={ReferenceLocation}"; 86 | } 87 | if (SlideLevel != null) 88 | { 89 | yield return $"--slide-level={SlideLevel}"; 90 | } 91 | if (Incremental) 92 | { 93 | yield return "--incremental"; 94 | } 95 | if (SectionDivs) 96 | { 97 | yield return "--section-divs"; 98 | } 99 | if (IdPrefix != null) 100 | { 101 | yield return $"--id-prefix={IdPrefix}"; 102 | } 103 | if (Css != null) 104 | { 105 | yield return $"--css={Css}"; 106 | } 107 | if (TitlePrefix != null) 108 | { 109 | yield return $"--title-prefix={TitlePrefix}"; 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/DzSlidesOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://paulrouget.com/dzslides/ 5 | /// 6 | public class DzSlidesOut : 7 | OutOptions 8 | { 9 | public override string Format => "dzslides"; 10 | 11 | /// 12 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 13 | /// https://pandoc.org/MANUAL.html#option--self-contained 14 | /// 15 | public bool SelfContained { get; set; } 16 | /// 17 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 18 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 19 | /// 20 | public bool HtmlQTags { get; set; } 21 | /// 22 | /// Make list items in slide shows display incrementally (one by one). The default is for lists to be displayed all at once. 23 | /// https://pandoc.org/MANUAL.html#option--incremental 24 | /// 25 | public bool Incremental { get; set; } 26 | /// 27 | /// Specifies that headings with the specified level create slides 28 | /// https://pandoc.org/MANUAL.html#option--slide-level 29 | /// 30 | public int? SlideLevel { get; set; } 31 | /// 32 | /// Use only ASCII characters in output 33 | /// https://pandoc.org/MANUAL.html#option--ascii 34 | /// 35 | public bool Ascii { get; set; } 36 | /// 37 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 38 | /// https://pandoc.org/MANUAL.html#option--section-divs 39 | /// 40 | public bool SectionDivs { get; set; } 41 | /// 42 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 43 | /// https://pandoc.org/MANUAL.html#option--reference-location 44 | /// 45 | public ReferenceLocation? ReferenceLocation { get; set; } 46 | /// 47 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 48 | /// https://pandoc.org/MANUAL.html#option--id-prefix 49 | /// 50 | public string? IdPrefix { get; set; } 51 | /// 52 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 53 | /// https://pandoc.org/MANUAL.html#option--css 54 | /// 55 | public string? Css { get; set; } 56 | /// 57 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 58 | /// https://pandoc.org/MANUAL.html#option--title-prefix 59 | /// 60 | public string? TitlePrefix { get; set; } 61 | 62 | public override IEnumerable GetArguments() 63 | { 64 | foreach (var argument in base.GetArguments()) 65 | { 66 | yield return argument; 67 | } 68 | 69 | if (SelfContained) 70 | { 71 | yield return "--self-contained"; 72 | } 73 | 74 | if (Ascii) 75 | { 76 | yield return "--ascii"; 77 | } 78 | 79 | if (HtmlQTags) 80 | { 81 | yield return "--html-q-tags"; 82 | } 83 | if (ReferenceLocation != null) 84 | { 85 | yield return $"--reference-location={ReferenceLocation}"; 86 | } 87 | if (SlideLevel != null) 88 | { 89 | yield return $"--slide-level={SlideLevel}"; 90 | } 91 | if (SectionDivs) 92 | { 93 | yield return "--section-divs"; 94 | } 95 | if (Incremental) 96 | { 97 | yield return "--incremental"; 98 | } 99 | if (IdPrefix != null) 100 | { 101 | yield return $"--id-prefix={IdPrefix}"; 102 | } 103 | if (Css != null) 104 | { 105 | yield return $"--css={Css}"; 106 | } 107 | if (TitlePrefix != null) 108 | { 109 | yield return $"--title-prefix={TitlePrefix}"; 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/PptxOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://en.wikipedia.org/wiki/Microsoft_PowerPoint 5 | /// 6 | public class PptxOut : 7 | OutOptions 8 | { 9 | public override string Format => "pptx"; 10 | 11 | /// 12 | /// Use the specified file as a style reference in producing 13 | /// https://pandoc.org/MANUAL.html#option--reference-doc 14 | /// 15 | public string? ReferenceDoc { get; set; } 16 | 17 | public override IEnumerable GetArguments() 18 | { 19 | foreach (var argument in base.GetArguments()) 20 | { 21 | yield return argument; 22 | } 23 | 24 | if (ReferenceDoc != null) 25 | { 26 | yield return $"--reference-doc={ReferenceDoc}"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/RevealJsOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://revealjs.com/ 5 | /// 6 | public class RevealJsOut : 7 | OutOptions 8 | { 9 | public override string Format => "revealjs"; 10 | 11 | /// 12 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 13 | /// https://pandoc.org/MANUAL.html#option--self-contained 14 | /// 15 | public bool SelfContained { get; set; } 16 | /// 17 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 18 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 19 | /// 20 | public bool HtmlQTags { get; set; } 21 | /// 22 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 23 | /// https://pandoc.org/MANUAL.html#option--section-divs 24 | /// 25 | public bool SectionDivs { get; set; } 26 | /// 27 | /// Use only ASCII characters in output 28 | /// https://pandoc.org/MANUAL.html#option--ascii 29 | /// 30 | public bool Ascii { get; set; } 31 | /// 32 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 33 | /// https://pandoc.org/MANUAL.html#option--reference-location 34 | /// 35 | public ReferenceLocation? ReferenceLocation { get; set; } 36 | /// 37 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 38 | /// https://pandoc.org/MANUAL.html#option--id-prefix 39 | /// 40 | public string? IdPrefix { get; set; } 41 | /// 42 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 43 | /// https://pandoc.org/MANUAL.html#option--css 44 | /// 45 | public string? Css { get; set; } 46 | /// 47 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 48 | /// https://pandoc.org/MANUAL.html#option--title-prefix 49 | /// 50 | public string? TitlePrefix { get; set; } 51 | 52 | public override IEnumerable GetArguments() 53 | { 54 | foreach (var argument in base.GetArguments()) 55 | { 56 | yield return argument; 57 | } 58 | 59 | if (SelfContained) 60 | { 61 | yield return "--self-contained"; 62 | } 63 | 64 | if (Ascii) 65 | { 66 | yield return "--ascii"; 67 | } 68 | 69 | if (HtmlQTags) 70 | { 71 | yield return "--html-q-tags"; 72 | } 73 | if (SectionDivs) 74 | { 75 | yield return "--section-divs"; 76 | } 77 | if (ReferenceLocation != null) 78 | { 79 | yield return $"--reference-location={ReferenceLocation}"; 80 | } 81 | if (IdPrefix != null) 82 | { 83 | yield return $"--id-prefix={IdPrefix}"; 84 | } 85 | if (Css != null) 86 | { 87 | yield return $"--css={Css}"; 88 | } 89 | if (TitlePrefix != null) 90 | { 91 | yield return $"--title-prefix={TitlePrefix}"; 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/S5Out.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://meyerweb.com/eric/tools/s5/ 5 | /// 6 | public class S5Out : 7 | OutOptions 8 | { 9 | public override string Format => "s5"; 10 | 11 | /// 12 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 13 | /// https://pandoc.org/MANUAL.html#option--self-contained 14 | /// 15 | public bool SelfContained { get; set; } 16 | /// 17 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 18 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 19 | /// 20 | public bool HtmlQTags { get; set; } 21 | /// 22 | /// Use only ASCII characters in output 23 | /// https://pandoc.org/MANUAL.html#option--ascii 24 | /// 25 | public bool Ascii { get; set; } 26 | /// 27 | /// Specifies that headings with the specified level create slides 28 | /// https://pandoc.org/MANUAL.html#option--slide-level 29 | /// 30 | public int? SlideLevel { get; set; } 31 | /// 32 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 33 | /// https://pandoc.org/MANUAL.html#option--section-divs 34 | /// 35 | public bool SectionDivs { get; set; } 36 | /// 37 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 38 | /// https://pandoc.org/MANUAL.html#option--reference-location 39 | /// 40 | public ReferenceLocation? ReferenceLocation { get; set; } 41 | /// 42 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 43 | /// https://pandoc.org/MANUAL.html#option--id-prefix 44 | /// 45 | public string? IdPrefix { get; set; } 46 | /// 47 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 48 | /// https://pandoc.org/MANUAL.html#option--css 49 | /// 50 | public string? Css { get; set; } 51 | /// 52 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 53 | /// https://pandoc.org/MANUAL.html#option--title-prefix 54 | /// 55 | public string? TitlePrefix { get; set; } 56 | 57 | public override IEnumerable GetArguments() 58 | { 59 | foreach (var argument in base.GetArguments()) 60 | { 61 | yield return argument; 62 | } 63 | 64 | if (SelfContained) 65 | { 66 | yield return "--self-contained"; 67 | } 68 | 69 | if (Ascii) 70 | { 71 | yield return "--ascii"; 72 | } 73 | 74 | if (HtmlQTags) 75 | { 76 | yield return "--html-q-tags"; 77 | } 78 | if (SlideLevel != null) 79 | { 80 | yield return $"--slide-level={SlideLevel}"; 81 | } 82 | if (SectionDivs) 83 | { 84 | yield return "--section-divs"; 85 | } 86 | if (ReferenceLocation != null) 87 | { 88 | yield return $"--reference-location={ReferenceLocation}"; 89 | } 90 | if (IdPrefix != null) 91 | { 92 | yield return $"--id-prefix={IdPrefix}"; 93 | } 94 | if (Css != null) 95 | { 96 | yield return $"--css={Css}"; 97 | } 98 | if (TitlePrefix != null) 99 | { 100 | yield return $"--title-prefix={TitlePrefix}"; 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/SlideousOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://goessner.net/articles/slideous/ 5 | /// 6 | public class SlideousOut : 7 | OutOptions 8 | { 9 | public override string Format => "slideous"; 10 | 11 | /// 12 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 13 | /// https://pandoc.org/MANUAL.html#option--self-contained 14 | /// 15 | public bool SelfContained { get; set; } 16 | /// 17 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 18 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 19 | /// 20 | public bool HtmlQTags { get; set; } 21 | /// 22 | /// Use only ASCII characters in output 23 | /// https://pandoc.org/MANUAL.html#option--ascii 24 | /// 25 | public bool Ascii { get; set; } 26 | /// 27 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 28 | /// https://pandoc.org/MANUAL.html#option--section-divs 29 | /// 30 | public bool SectionDivs { get; set; } 31 | /// 32 | /// Specifies that headings with the specified level create slides 33 | /// https://pandoc.org/MANUAL.html#option--slide-level 34 | /// 35 | public int? SlideLevel { get; set; } 36 | /// 37 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 38 | /// https://pandoc.org/MANUAL.html#option--id-prefix 39 | /// 40 | public string? IdPrefix { get; set; } 41 | /// 42 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 43 | /// https://pandoc.org/MANUAL.html#option--reference-location 44 | /// 45 | public ReferenceLocation? ReferenceLocation { get; set; } 46 | /// 47 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 48 | /// https://pandoc.org/MANUAL.html#option--css 49 | /// 50 | public string? Css { get; set; } 51 | /// 52 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 53 | /// https://pandoc.org/MANUAL.html#option--title-prefix 54 | /// 55 | public string? TitlePrefix { get; set; } 56 | 57 | public override IEnumerable GetArguments() 58 | { 59 | foreach (var argument in base.GetArguments()) 60 | { 61 | yield return argument; 62 | } 63 | 64 | if (SelfContained) 65 | { 66 | yield return "--self-contained"; 67 | } 68 | 69 | if (Ascii) 70 | { 71 | yield return "--ascii"; 72 | } 73 | 74 | if (HtmlQTags) 75 | { 76 | yield return "--html-q-tags"; 77 | } 78 | if (SlideLevel != null) 79 | { 80 | yield return $"--slide-level={SlideLevel}"; 81 | } 82 | if (SectionDivs) 83 | { 84 | yield return "--section-divs"; 85 | } 86 | if (ReferenceLocation != null) 87 | { 88 | yield return $"--reference-location={ReferenceLocation}"; 89 | } 90 | if (IdPrefix != null) 91 | { 92 | yield return $"--id-prefix={IdPrefix}"; 93 | } 94 | if (Css != null) 95 | { 96 | yield return $"--css={Css}"; 97 | } 98 | if (TitlePrefix != null) 99 | { 100 | yield return $"--title-prefix={TitlePrefix}"; 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Slides/SlidyOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.w3.org/Talks/Tools/Slidy2/ 5 | /// 6 | public class SlidyOut : 7 | OutOptions 8 | { 9 | public override string Format => "slidy"; 10 | 11 | /// 12 | /// Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos 13 | /// https://pandoc.org/MANUAL.html#option--self-contained 14 | /// 15 | public bool SelfContained { get; set; } 16 | /// 17 | /// Use <q> tags for quotes in HTML. (This option only has an effect if the smart extension is enabled for the input format used.) 18 | /// https://pandoc.org/MANUAL.html#option--html-q-tags 19 | /// 20 | public bool HtmlQTags { get; set; } 21 | /// 22 | /// Use only ASCII characters in output 23 | /// https://pandoc.org/MANUAL.html#option--ascii 24 | /// 25 | public bool Ascii { get; set; } 26 | /// 27 | /// Wrap sections in <section> tags (or <div> tags for html4), and attach identifiers to the enclosing <section> (or <div>) rather than the heading itself 28 | /// https://pandoc.org/MANUAL.html#option--section-divs 29 | /// 30 | public bool SectionDivs { get; set; } 31 | /// 32 | /// Specifies that headings with the specified level create slides 33 | /// https://pandoc.org/MANUAL.html#option--slide-level 34 | /// 35 | public int? SlideLevel { get; set; } 36 | /// 37 | /// Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. 38 | /// https://pandoc.org/MANUAL.html#option--reference-location 39 | /// 40 | public ReferenceLocation? ReferenceLocation { get; set; } 41 | /// 42 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 43 | /// https://pandoc.org/MANUAL.html#option--id-prefix 44 | /// 45 | public string? IdPrefix { get; set; } 46 | /// 47 | /// Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified. 48 | /// https://pandoc.org/MANUAL.html#option--css 49 | /// 50 | public string? Css { get; set; } 51 | /// 52 | /// Specify STRING as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). 53 | /// https://pandoc.org/MANUAL.html#option--title-prefix 54 | /// 55 | public string? TitlePrefix { get; set; } 56 | 57 | public override IEnumerable GetArguments() 58 | { 59 | foreach (var argument in base.GetArguments()) 60 | { 61 | yield return argument; 62 | } 63 | 64 | if (SelfContained) 65 | { 66 | yield return "--self-contained"; 67 | } 68 | 69 | if (Ascii) 70 | { 71 | yield return "--ascii"; 72 | } 73 | 74 | if (HtmlQTags) 75 | { 76 | yield return "--html-q-tags"; 77 | } 78 | if (SectionDivs) 79 | { 80 | yield return "--section-divs"; 81 | } 82 | 83 | if (SlideLevel != null) 84 | { 85 | yield return $"--slide-level={SlideLevel}"; 86 | } 87 | if (SectionDivs) 88 | { 89 | yield return "--section-divs"; 90 | } 91 | if (ReferenceLocation != null) 92 | { 93 | yield return $"--reference-location={ReferenceLocation}"; 94 | } 95 | if (IdPrefix != null) 96 | { 97 | yield return $"--id-prefix={IdPrefix}"; 98 | } 99 | if (Css != null) 100 | { 101 | yield return $"--css={Css}"; 102 | } 103 | if (TitlePrefix != null) 104 | { 105 | yield return $"--title-prefix={TitlePrefix}"; 106 | } 107 | } 108 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/TeiOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://github.com/TEIC/TEI-Simple 5 | /// 6 | public class TeiOut : 7 | OutOptions 8 | { 9 | public override string Format => "tei"; 10 | 11 | /// 12 | /// Treat top-level headings as the given division output.The hierarchy order is part, chapter, then section; all headings are shifted such that the top-level heading becomes the specified type 13 | /// https://pandoc.org/MANUAL.html#option--top-level-division 14 | /// 15 | public TopLevelDivision? TopLevelDivision { get; set; } 16 | /// 17 | /// Number section headings 18 | /// https://pandoc.org/MANUAL.html#option--number-sections 19 | /// 20 | public bool NumberSections { get; set; } 21 | 22 | public override IEnumerable GetArguments() 23 | { 24 | foreach (var argument in base.GetArguments()) 25 | { 26 | yield return argument; 27 | } 28 | 29 | if (TopLevelDivision != null) 30 | { 31 | yield return $"--top-level-division={TopLevelDivision}"; 32 | } 33 | if (NumberSections) 34 | { 35 | yield return "--number-sections"; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/TexInfoOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.gnu.org/software/texinfo/ 5 | /// 6 | public class TexInfoOut : 7 | OutOptions 8 | { 9 | public override string Format => "texinfo"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/TextileOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.promptworks.com/textile 5 | /// 6 | public class TextileOut : 7 | OutOptions 8 | { 9 | public override string Format => "textile"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/TopLevelDivision.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// Treat top-level headings as the given division type in LaTeX, ConTeXt, DocBook, and TEI output 5 | /// https://pandoc.org/MANUAL.html#option--top-level-division 6 | /// 7 | public enum TopLevelDivision 8 | { 9 | Default, 10 | Section, 11 | Chapter, 12 | Part 13 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/TxtOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class TxtOut : 4 | OutOptions 5 | { 6 | public override string Format => "plain"; 7 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/Wrap.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// Determine how text is wrapped in the output (the source code, not the rendered version). 5 | /// https://pandoc.org/MANUAL.html#option--wrap 6 | /// 7 | public enum Wrap 8 | { 9 | Auto, 10 | None, 11 | Preserve 12 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/XWikiOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/ 5 | /// 6 | public class XWikiOut : 7 | OutOptions 8 | { 9 | public override string Format => "xwiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Output/ZimWikiOut.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | /// 4 | /// https://zim-wiki.org/manual/Help/Wiki_Syntax.html 5 | /// 6 | public class ZimWikiOut : 7 | OutOptions 8 | { 9 | public override string Format => "zimwiki"; 10 | } -------------------------------------------------------------------------------- /src/PandocNet/Pandoc.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net7.0;net8.0;net9.0 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/PandocNet/PandocEngine.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public class PandocEngine(string? pandocPath = null) 4 | { 5 | internal string pandocPath = pandocPath ?? "pandoc"; 6 | 7 | public virtual async Task ConvertToText( 8 | Input input, 9 | TIn? inOptions = null, 10 | TOut? outOptions = null, 11 | Options? options = null, 12 | Cancel cancel = default) 13 | where TIn : InOptions, new() 14 | where TOut : OutOptions, new() 15 | { 16 | var output = new StringBuilder(); 17 | var command = await Convert(input, output, inOptions, outOptions, options, cancel); 18 | return new(command.Command, output.ToString()); 19 | } 20 | 21 | public async Task Convert( 22 | Input input, 23 | Output output, 24 | TIn? inOptions, 25 | TOut? outOptions, 26 | Options? options, 27 | Cancel cancel = default) 28 | where TIn : InOptions, new() 29 | where TOut : OutOptions, new() 30 | { 31 | inOptions ??= new(); 32 | outOptions ??= new(); 33 | var source = input.GetPipeSource(); 34 | var target = output.GetPipeTarget(); 35 | var errors = new StringBuilder(); 36 | var arguments = new List(Options.GetArguments(options)) 37 | { 38 | // Force binary to stdout 39 | "--output=-" 40 | }; 41 | arguments.AddRange(inOptions.GetArguments()); 42 | arguments.AddRange(outOptions.GetArguments()); 43 | var command = Cli.Wrap(pandocPath) 44 | .WithArguments(arguments) 45 | .WithStandardOutputPipe(target) 46 | .WithStandardInputPipe(source) 47 | .WithStandardErrorPipe(PipeTarget.ToStringBuilder(errors)) 48 | .WithValidation(CommandResultValidation.None); 49 | 50 | var result = await command.ExecuteAsync(cancel); 51 | CheckErrorCodes(result, errors, command); 52 | return new(command.ToString()); 53 | } 54 | 55 | static void CheckErrorCodes(CommandResult result, StringBuilder errors, Command command) 56 | { 57 | var exitCode = result.ExitCode; 58 | 59 | if (exitCode == 0) 60 | { 61 | return; 62 | } 63 | 64 | var errorType = ErrorCodes.GetErrorType(exitCode); 65 | throw new( 66 | $""" 67 | {errorType} ({exitCode}): 68 | {command} 69 | {errors} 70 | """); 71 | } 72 | } -------------------------------------------------------------------------------- /src/PandocNet/PandocInstance.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public static class PandocInstance 4 | { 5 | static PandocEngine instance = new(); 6 | 7 | public static void SetPandocPath(string pandocPath) => 8 | instance.pandocPath = pandocPath; 9 | 10 | public static Task ConvertToText( 11 | string content, 12 | TIn? inOptions = null, 13 | TOut? outOptions = null, 14 | Options? options = null, 15 | Cancel cancel = default) 16 | where TIn : InOptions, new() 17 | where TOut : OutOptions, new() => 18 | instance.ConvertToText(content, inOptions, outOptions, options, cancel); 19 | 20 | public static Task ConvertToText( 21 | Input input, 22 | TIn? inOptions = null, 23 | TOut? outOptions = null, 24 | Options? options = null, 25 | Cancel cancel = default) 26 | where TIn : InOptions, new() 27 | where TOut : OutOptions, new() => 28 | instance.ConvertToText(input, inOptions, outOptions, options, cancel); 29 | 30 | public static Task Convert( 31 | Input input, 32 | Output output, 33 | TIn? inOptions = null, 34 | TOut? outOptions = null, 35 | Options? options = null, 36 | Cancel cancel = default) 37 | where TIn : InOptions, new() 38 | where TOut : OutOptions, new() => 39 | instance.Convert(input, output, inOptions, outOptions, options, cancel); 40 | } -------------------------------------------------------------------------------- /src/PandocNet/Result.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public record Result(string Command); -------------------------------------------------------------------------------- /src/PandocNet/StringResult.cs: -------------------------------------------------------------------------------- 1 | namespace Pandoc; 2 | 3 | public record StringResult(string Command, string Value) 4 | { 5 | public override string ToString() => 6 | Value; 7 | 8 | public static implicit operator string(StringResult x) => x.Value; 9 | } -------------------------------------------------------------------------------- /src/Shared.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | False 3 | Quiet 4 | True 5 | True 6 | True 7 | DO_NOT_SHOW 8 | ERROR 9 | ERROR 10 | ERROR 11 | WARNING 12 | ERROR 13 | ERROR 14 | ERROR 15 | ERROR 16 | ERROR 17 | ERROR 18 | ERROR 19 | ERROR 20 | ERROR 21 | ERROR 22 | ERROR 23 | ERROR 24 | ERROR 25 | ERROR 26 | ERROR 27 | ERROR 28 | ERROR 29 | ERROR 30 | ERROR 31 | ERROR 32 | ERROR 33 | ERROR 34 | ERROR 35 | ERROR 36 | ERROR 37 | ERROR 38 | ERROR 39 | ERROR 40 | ERROR 41 | ERROR 42 | ERROR 43 | DO_NOT_SHOW 44 | DO_NOT_SHOW 45 | ERROR 46 | ERROR 47 | ERROR 48 | ERROR 49 | ERROR 50 | ERROR 51 | ERROR 52 | ERROR 53 | ERROR 54 | ERROR 55 | ERROR 56 | ERROR 57 | C90+,E79+,S14+ 58 | ERROR 59 | ERROR 60 | ERROR 61 | ERROR 62 | ERROR 63 | ERROR 64 | ERROR 65 | ERROR 66 | ERROR 67 | ERROR 68 | ERROR 69 | ERROR 70 | ERROR 71 | ERROR 72 | ERROR 73 | ERROR 74 | ERROR 75 | ERROR 76 | ERROR 77 | ERROR 78 | ERROR 79 | ERROR 80 | ERROR 81 | ERROR 82 | ERROR 83 | ERROR 84 | ERROR 85 | ERROR 86 | ERROR 87 | ERROR 88 | ERROR 89 | ERROR 90 | ERROR 91 | ERROR 92 | ERROR 93 | ERROR 94 | ERROR 95 | ERROR 96 | ERROR 97 | ERROR 98 | ERROR 99 | ERROR 100 | ERROR 101 | ERROR 102 | ERROR 103 | ERROR 104 | ERROR 105 | ERROR 106 | ERROR 107 | ERROR 108 | ERROR 109 | ERROR 110 | ERROR 111 | ERROR 112 | ERROR 113 | ERROR 114 | ERROR 115 | ERROR 116 | ERROR 117 | ERROR 118 | ERROR 119 | ERROR 120 | ERROR 121 | ERROR 122 | DO_NOT_SHOW 123 | *.received.* 124 | *.verified.* 125 | ERROR 126 | ERROR 127 | DO_NOT_SHOW 128 | ECMAScript 2016 129 | <?xml version="1.0" encoding="utf-16"?><Profile name="c# Cleanup"><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CSCodeStyleAttributes ArrangeVarStyle="True" ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeCodeBodyStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" /><CssAlphabetizeProperties>True</CssAlphabetizeProperties><JSStringLiteralQuotesDescriptor>True</JSStringLiteralQuotesDescriptor><CorrectVariableKindsDescriptor>True</CorrectVariableKindsDescriptor><VariablesToInnerScopesDescriptor>True</VariablesToInnerScopesDescriptor><StringToTemplatesDescriptor>True</StringToTemplatesDescriptor><JsInsertSemicolon>True</JsInsertSemicolon><RemoveRedundantQualifiersTs>True</RemoveRedundantQualifiersTs><OptimizeImportsTs>True</OptimizeImportsTs><OptimizeReferenceCommentsTs>True</OptimizeReferenceCommentsTs><PublicModifierStyleTs>True</PublicModifierStyleTs><ExplicitAnyTs>True</ExplicitAnyTs><TypeAnnotationStyleTs>True</TypeAnnotationStyleTs><RelativePathStyleTs>True</RelativePathStyleTs><AsInsteadOfCastTs>True</AsInsteadOfCastTs><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CssReformatCode>True</CssReformatCode><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor><HtmlReformatCode>True</HtmlReformatCode><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><IDEA_SETTINGS>&lt;profile version="1.0"&gt; 130 | &lt;option name="myName" value="c# Cleanup" /&gt; 131 | &lt;/profile&gt;</IDEA_SETTINGS><RIDER_SETTINGS>&lt;profile&gt; 132 | &lt;Language id="EditorConfig"&gt; 133 | &lt;Reformat&gt;false&lt;/Reformat&gt; 134 | &lt;/Language&gt; 135 | &lt;Language id="HTML"&gt; 136 | &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; 137 | &lt;Reformat&gt;false&lt;/Reformat&gt; 138 | &lt;Rearrange&gt;false&lt;/Rearrange&gt; 139 | &lt;/Language&gt; 140 | &lt;Language id="JSON"&gt; 141 | &lt;Reformat&gt;false&lt;/Reformat&gt; 142 | &lt;/Language&gt; 143 | &lt;Language id="RELAX-NG"&gt; 144 | &lt;Reformat&gt;false&lt;/Reformat&gt; 145 | &lt;/Language&gt; 146 | &lt;Language id="XML"&gt; 147 | &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; 148 | &lt;Reformat&gt;false&lt;/Reformat&gt; 149 | &lt;Rearrange&gt;false&lt;/Rearrange&gt; 150 | &lt;/Language&gt; 151 | &lt;/profile&gt;</RIDER_SETTINGS></Profile> 152 | ExpressionBody 153 | ExpressionBody 154 | ExpressionBody 155 | False 156 | NEVER 157 | NEVER 158 | False 159 | False 160 | False 161 | True 162 | False 163 | CHOP_ALWAYS 164 | False 165 | False 166 | RemoveIndent 167 | RemoveIndent 168 | False 169 | True 170 | True 171 | True 172 | True 173 | True 174 | ERROR 175 | DoNothing 176 | -------------------------------------------------------------------------------- /src/Tests/ output.html: -------------------------------------------------------------------------------- 1 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ac faucibus odio.

2 |

Vestibulum neque massa, scelerisque sit amet ligula eu, congue molestie mi. Praesent ut varius sem. Nullam at porttitor arcu, nec lacinia nisi. Ut ac dolor vitae odio interdum condimentum. Vivamus dapibus sodales ex, vitae malesuada ipsum cursus convallis. Maecenas sed egestas nulla, ac condimentum orci. Mauris diam felis, vulputate ac suscipit et, iaculis non est. Curabitur semper arcu ac ligula semper, nec luctus nisl blandit. Integer lacinia ante ac libero lobortis imperdiet. Nullam mollis convallis ipsum, ac accumsan nunc vehicula vitae. Nulla eget justo in felis tristique fringilla. Morbi sit amet tortor quis risus auctor condimentum. Morbi in ullamcorper elit. Nulla iaculis tellus sit amet mauris tempus fringilla.

3 |

Maecenas mauris lectus, lobortis et purus mattis, blandit dictum tellus.

4 |
    5 |
  • Maecenas non lorem quis tellus placerat varius.

  • 6 |
  • Nulla facilisi.

  • 7 |
  • Aenean congue fringilla justo ut aliquam.

  • 8 |
  • Mauris id ex erat. Nunc vulputate neque vitae justo facilisis, non condimentum ante sagittis.

  • 9 |
  • Morbi viverra semper lorem nec molestie.

  • 10 |
  • Maecenas tincidunt est efficitur ligula euismod, sit amet ornare est vulputate.

  • 11 |
12 |

[CHART]

13 | -------------------------------------------------------------------------------- /src/Tests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Pandoc; 2 | global using VerifyTests.DiffPlex; -------------------------------------------------------------------------------- /src/Tests/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | [assembly: NonParallelizable] 2 | 3 | public static class ModuleInitializer 4 | { 5 | [ModuleInitializer] 6 | public static void Initialize() 7 | { 8 | VerifyDiffPlex.Initialize(OutputType.Compact); 9 | VerifierSettings.UniqueForOSPlatform(); 10 | } 11 | } -------------------------------------------------------------------------------- /src/Tests/Samples.CustomOptions.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 

3.0.1 2 | Heading1

3 |

text

4 |

3.0.1.1 Heading2

6 |

text

7 | -------------------------------------------------------------------------------- /src/Tests/Samples.Files.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | 
5 | -------------------------------------------------------------------------------- /src/Tests/Samples.Files.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | -------------------------------------------------------------------------------- /src/Tests/Samples.Streams.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | 
5 | -------------------------------------------------------------------------------- /src/Tests/Samples.Streams.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | -------------------------------------------------------------------------------- /src/Tests/Samples.Text.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 

text

2 | -------------------------------------------------------------------------------- /src/Tests/Samples.Text.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 

text

2 | -------------------------------------------------------------------------------- /src/Tests/Samples.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable UnusedVariable 2 | 3 | [TestFixture] 4 | public class Samples 5 | { 6 | [Test] 7 | public void PandocPath() 8 | { 9 | #region PandocPath 10 | 11 | var engine = new PandocEngine(@"D:\Tools\pandoc.exe"); 12 | 13 | #endregion 14 | } 15 | 16 | [Test] 17 | public async Task Files() 18 | { 19 | #region files 20 | 21 | await PandocInstance.Convert("sample.md", "output.html"); 22 | 23 | #endregion 24 | 25 | await VerifyFile("output.html"); 26 | } 27 | 28 | [Test] 29 | public async Task Streams() 30 | { 31 | { 32 | #region streams 33 | 34 | await using var inStream = File.OpenRead("sample.md"); 35 | await using var outStream = File.OpenWrite("output.html"); 36 | await PandocInstance.Convert(inStream, outStream); 37 | 38 | #endregion 39 | } 40 | 41 | await VerifyFile("output.html"); 42 | } 43 | 44 | [Test] 45 | public async Task Text() 46 | { 47 | #region text 48 | 49 | var html = await PandocInstance.ConvertToText("*text*"); 50 | 51 | #endregion 52 | 53 | await Verify(html.Value, "html"); 54 | } 55 | 56 | [Test] 57 | [Explicit] 58 | public async Task CustomOptions() 59 | { 60 | #region custom-options 61 | 62 | var html = await PandocInstance.ConvertToText( 63 | """ 64 | 65 | # Heading1 66 | 67 | text 68 | 69 | ## Heading2 70 | 71 | text 72 | 73 | """, 74 | new CommonMarkIn 75 | { 76 | ShiftHeadingLevelBy = 2 77 | }, 78 | new HtmlOut 79 | { 80 | NumberOffsets = [3] 81 | }); 82 | 83 | #endregion 84 | 85 | await Verify(html.Value, "html"); 86 | } 87 | } -------------------------------------------------------------------------------- /src/Tests/Tests.BinaryToText.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 

Lorem 3 | ipsum dolor sit amet, consectetur adipiscing elit. Nunc ac faucibus 4 | odio.

5 |

Vestibulum neque massa, scelerisque sit amet ligula eu, congue 6 | molestie mi. Praesent ut varius sem. Nullam at porttitor arcu, nec 7 | lacinia nisi. Ut ac dolor vitae odio interdum condimentum. 8 | Vivamus dapibus sodales ex, vitae malesuada ipsum cursus 9 | convallis. Maecenas sed egestas nulla, ac condimentum orci. 10 | Mauris diam felis, vulputate ac suscipit et, iaculis non est. Curabitur 11 | semper arcu ac ligula semper, nec luctus nisl blandit. Integer lacinia 12 | ante ac libero lobortis imperdiet. Nullam mollis convallis ipsum, ac 13 | accumsan nunc vehicula vitae. Nulla eget justo in felis tristique 14 | fringilla. Morbi sit amet tortor quis risus auctor condimentum. Morbi in 15 | ullamcorper elit. Nulla iaculis tellus sit amet mauris tempus 16 | fringilla.

17 |

Maecenas mauris lectus, lobortis et purus mattis, blandit dictum 18 | tellus.

19 |
    20 |
  • Maecenas non lorem quis tellus placerat 21 | varius.

  • 22 |
  • Nulla facilisi.

  • 23 |
  • Aenean congue fringilla justo ut aliquam.

  • 24 |
  • Mauris id ex 25 | erat. Nunc vulputate neque vitae justo facilisis, non 26 | condimentum ante sagittis.

  • 27 |
  • Morbi viverra semper lorem nec molestie.

  • 28 |
  • Maecenas tincidunt est efficitur ligula euismod, sit amet ornare 29 | est vulputate.

  • 30 |
31 | -------------------------------------------------------------------------------- /src/Tests/Tests.BinaryToText.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=docx --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.CustomOptions.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 

3.0.1 2 | Heading1

3 | -------------------------------------------------------------------------------- /src/Tests/Tests.CustomOptions.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --shift-heading-level-by=2 --to=html --number-offset=3 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.DataDirectory.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | 
5 | -------------------------------------------------------------------------------- /src/Tests/Tests.DataDirectory.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --data-dir={CurrentDirectory} --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.DataDirectory.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | -------------------------------------------------------------------------------- /src/Tests/Tests.DataDirectory.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --data-dir={CurrentDirectory} --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.EncodingTest.Linux.verified.md: -------------------------------------------------------------------------------- 1 | 白日依山尽,黄河入海流。欲穷千里目,更上一层楼。 2 | 3 | -------------------------------------------------------------------------------- /src/Tests/Tests.EncodingTest.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=html --to=commonmark 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.EncodingTest.Windows.verified.md: -------------------------------------------------------------------------------- 1 | 白日依山尽,黄河入海流。欲穷千里目,更上一层楼。 2 | -------------------------------------------------------------------------------- /src/Tests/Tests.EncodingTest.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=html --to=commonmark 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.Files.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | 
5 | -------------------------------------------------------------------------------- /src/Tests/Tests.Files.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.Files.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | -------------------------------------------------------------------------------- /src/Tests/Tests.Files.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.InputOutput.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | 
5 | -------------------------------------------------------------------------------- /src/Tests/Tests.InputOutput.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.InputOutput.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | -------------------------------------------------------------------------------- /src/Tests/Tests.InputOutput.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.Streams.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | 
5 | -------------------------------------------------------------------------------- /src/Tests/Tests.Streams.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.Streams.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 
# code block
2 | print '3 backticks or'
3 | print 'indent 4 spaces'
4 | -------------------------------------------------------------------------------- /src/Tests/Tests.Streams.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.Text.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 

text

2 | -------------------------------------------------------------------------------- /src/Tests/Tests.Text.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.Text.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 

text

2 | -------------------------------------------------------------------------------- /src/Tests/Tests.Text.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.TextFromStream.Linux.verified.html: -------------------------------------------------------------------------------- 1 | 

text

2 | -------------------------------------------------------------------------------- /src/Tests/Tests.TextFromStream.Linux.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.TextFromStream.Windows.verified.html: -------------------------------------------------------------------------------- 1 | 

text

2 | -------------------------------------------------------------------------------- /src/Tests/Tests.TextFromStream.Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | target: null, 3 | command: pandoc --output=- --from=commonmark --to=html 4 | } -------------------------------------------------------------------------------- /src/Tests/Tests.cs: -------------------------------------------------------------------------------- 1 | [TestFixture] 2 | public class Tests 3 | { 4 | [Test] 5 | public void InputsAndOutputs() 6 | { 7 | WriteInclude("Input"); 8 | WriteInclude("Output"); 9 | } 10 | 11 | static void WriteInclude(string target) 12 | { 13 | var solutionDirectory = AttributeReader.GetSolutionDirectory(); 14 | var includePath = Path.Combine(solutionDirectory, $"{target.ToLower()}.include.md"); 15 | var builder = new StringBuilder(); 16 | var projectDirectory = Path.Combine(solutionDirectory, "PandocNet"); 17 | var targetDirectory = Path.Combine(projectDirectory, target); 18 | foreach (var file in Directory.EnumerateFiles(targetDirectory, "*", SearchOption.AllDirectories)) 19 | { 20 | var fileContent = File.ReadAllText(file) 21 | .Replace("namespace Pandoc;", "") 22 | .Trim(); 23 | builder.AppendLine( 24 | $""" 25 | #### {Path.GetFileNameWithoutExtension(file)} 26 | 27 | ```cs 28 | {fileContent} 29 | ``` 30 | 31 | 32 | """); 33 | } 34 | 35 | File.Delete(includePath); 36 | File.WriteAllText(includePath, builder.ToString()); 37 | } 38 | 39 | [Test] 40 | [Explicit] 41 | public async Task BinaryToText() 42 | { 43 | var result = await PandocInstance.Convert("sample.docx", "output.html"); 44 | 45 | await VerifyFile("output.html") 46 | .AppendValue("command", result.Command); 47 | } 48 | 49 | [Test] 50 | public async Task DataDirectory() 51 | { 52 | var result = await PandocInstance.Convert( 53 | "sample.md", 54 | "output.html", 55 | options: new() 56 | { 57 | DataDirectory = Environment.CurrentDirectory 58 | }); 59 | 60 | await VerifyFile("output.html") 61 | .AppendValue("command", result.Command); 62 | } 63 | 64 | [Test] 65 | public async Task Files() 66 | { 67 | var result = await PandocInstance.Convert("sample.md", "output.html"); 68 | 69 | await VerifyFile("output.html") 70 | .AppendValue("command", result.Command); 71 | } 72 | 73 | [Test] 74 | public async Task Streams() 75 | { 76 | var result = await PandocInstance.Convert("sample.md", "output.html"); 77 | 78 | await VerifyFile("output.html") 79 | .AppendValue("command", result.Command); 80 | } 81 | 82 | [Test] 83 | public async Task InputOutput() 84 | { 85 | Pandoc.Result result; 86 | { 87 | await using var inStream = File.OpenRead("sample.md"); 88 | await using var outStream = File.OpenWrite("output.html"); 89 | result = await PandocInstance.Convert(inStream, outStream); 90 | } 91 | 92 | await VerifyFile("output.html") 93 | .AppendValue("command", result.Command); 94 | } 95 | 96 | [Test] 97 | public async Task Text() 98 | { 99 | var (command, value) = await PandocInstance.ConvertToText("*text*"); 100 | 101 | await Verify(value, "html") 102 | .AppendValue("command", command); 103 | } 104 | 105 | [Test] 106 | public async Task TextFromStream() 107 | { 108 | using var stream = new MemoryStream("*text*"u8.ToArray()); 109 | stream.Position = 0; 110 | 111 | var (command, value) = await PandocInstance.ConvertToText(stream); 112 | 113 | await Verify(value, "html") 114 | .AppendValue("command", command); 115 | } 116 | 117 | [Test] 118 | [Explicit] 119 | public async Task CustomOptions() 120 | { 121 | var (command, value) = await PandocInstance.ConvertToText( 122 | "# Heading1", 123 | new CommonMarkIn 124 | { 125 | ShiftHeadingLevelBy = 2 126 | }, 127 | new HtmlOut 128 | { 129 | NumberOffsets = [3] 130 | }); 131 | 132 | await Verify(value, "html") 133 | .AppendValue("command", command); 134 | } 135 | 136 | [Test] 137 | public async Task EncodingTest() 138 | { 139 | var (command, value) = await PandocInstance.ConvertToText( 140 | "白日依山尽,黄河入海流。欲穷千里目,更上一层楼。", 141 | new HtmlIn(), 142 | new CommonMarkOut()); 143 | 144 | await Verify(value, "md") 145 | .AppendValue("command", command); 146 | } 147 | } -------------------------------------------------------------------------------- /src/Tests/Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Tests/VerifyChecksTests.cs: -------------------------------------------------------------------------------- 1 | [TestFixture] 2 | public class VerifyChecksTests 3 | { 4 | [Test] 5 | public Task Run() => 6 | VerifyChecks.Run(); 7 | } -------------------------------------------------------------------------------- /src/Tests/sample.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCropp/PandocNet/295ab482693bc70498dcf54673750a3d7a3e0a92/src/Tests/sample.docx -------------------------------------------------------------------------------- /src/Tests/sample.md: -------------------------------------------------------------------------------- 1 | ``` 2 | # code block 3 | print '3 backticks or' 4 | print 'indent 4 spaces' 5 | ``` 6 | -------------------------------------------------------------------------------- /src/Tests/sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCropp/PandocNet/295ab482693bc70498dcf54673750a3d7a3e0a92/src/Tests/sample.pdf -------------------------------------------------------------------------------- /src/Tests/sample.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCropp/PandocNet/295ab482693bc70498dcf54673750a3d7a3e0a92/src/Tests/sample.pptx -------------------------------------------------------------------------------- /src/Tests/sample.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCropp/PandocNet/295ab482693bc70498dcf54673750a3d7a3e0a92/src/Tests/sample.xlsx -------------------------------------------------------------------------------- /src/appveyor.yml: -------------------------------------------------------------------------------- 1 | image: 2 | - Visual Studio 2022 3 | # - macOS 4 | - Ubuntu 5 | environment: 6 | DOTNET_NOLOGO: true 7 | DOTNET_CLI_TELEMETRY_OPTOUT: true 8 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true 9 | init: 10 | - pwsh: | 11 | if ($isWindows) { 12 | choco install pandoc 13 | } 14 | if ($isLinux) { 15 | sudo apt-get -yq install pandoc 16 | } 17 | # if ($isMacOS) { 18 | # brew install pandoc 19 | # } 20 | build_script: 21 | - pwsh: | 22 | if ($isWindows) { 23 | Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1" 24 | ./dotnet-install.ps1 -JSonFile src/global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet' 25 | } 26 | if ($isMacOS) { 27 | Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh" 28 | sudo chmod u+x dotnet-install.sh 29 | sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/local/share/dotnet' 30 | } 31 | if ($isLinux) { 32 | Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh" 33 | sudo chmod u+x dotnet-install.sh 34 | sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/share/dotnet' 35 | } 36 | - dotnet build src --configuration Release 37 | - dotnet test src --configuration Release --no-build --no-restore 38 | test: off 39 | on_failure: 40 | - ps: Get-ChildItem *.received.* -recurse | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } 41 | artifacts: 42 | - path: nugets\*.nupkg -------------------------------------------------------------------------------- /src/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.300", 4 | "allowPrerelease": true, 5 | "rollForward": "latestFeature" 6 | } 7 | } -------------------------------------------------------------------------------- /src/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCropp/PandocNet/295ab482693bc70498dcf54673750a3d7a3e0a92/src/icon.png -------------------------------------------------------------------------------- /src/input.include.md: -------------------------------------------------------------------------------- 1 | #### BibLaTeXIn 2 | 3 | ```cs 4 | /// 5 | /// https://ctan.org/pkg/biblatex 6 | /// 7 | public class BibLaTeXIn : 8 | InOptions 9 | { 10 | protected override string Format => "biblatex"; 11 | } 12 | ``` 13 | 14 | 15 | #### BibTexIn 16 | 17 | ```cs 18 | /// 19 | /// https://ctan.org/pkg/bibtex 20 | /// 21 | public class BibTexIn : 22 | InOptions 23 | { 24 | protected override string Format => "bibtex"; 25 | } 26 | ``` 27 | 28 | 29 | #### CreoleIn 30 | 31 | ```cs 32 | /// 33 | /// http://www.wikicreole.org/wiki/Creole1.0 34 | /// 35 | public class CreoleIn : 36 | InOptions 37 | { 38 | protected override string Format => "creole"; 39 | } 40 | ``` 41 | 42 | 43 | #### CsvIn 44 | 45 | ```cs 46 | /// 47 | /// https://datatracker.ietf.org/doc/html/rfc4180 48 | /// 49 | public class CsvIn : 50 | InOptions 51 | { 52 | protected override string Format => "csv"; 53 | } 54 | ``` 55 | 56 | 57 | #### DocBookIn 58 | 59 | ```cs 60 | /// 61 | /// https://docbook.org/ 62 | /// 63 | public class DocBookIn : 64 | InOptions 65 | { 66 | protected override string Format => "docbook"; 67 | } 68 | ``` 69 | 70 | 71 | #### DocxIn 72 | 73 | ```cs 74 | /// 75 | /// https://en.wikipedia.org/wiki/Office_Open_XML 76 | /// 77 | public class DocxIn : 78 | InOptions 79 | { 80 | protected override string Format => "docx"; 81 | 82 | /// 83 | /// Specifies what to do with insertions, deletions, and comments produced 84 | /// https://pandoc.org/MANUAL.html#option--track-changes 85 | /// 86 | public TrackChanges? TrackChanges { get; set; } 87 | 88 | public override IEnumerable GetArguments() 89 | { 90 | foreach (var argument in base.GetArguments()) 91 | { 92 | yield return argument; 93 | } 94 | 95 | if (TrackChanges != null) 96 | { 97 | yield return $"--track-changes={TrackChanges.Value.ToString().ToLower()}"; 98 | } 99 | } 100 | } 101 | ``` 102 | 103 | 104 | #### DokuWikiIn 105 | 106 | ```cs 107 | /// 108 | /// https://www.dokuwiki.org/dokuwiki 109 | /// 110 | public class DokuWikiIn : 111 | InOptions 112 | { 113 | protected override string Format => "dokuwiki"; 114 | } 115 | ``` 116 | 117 | 118 | #### EmacsOrgIn 119 | 120 | ```cs 121 | /// 122 | /// https://orgmode.org/ 123 | /// 124 | public class EmacsOrgIn : 125 | InOptions 126 | { 127 | protected override string Format => "org"; 128 | } 129 | ``` 130 | 131 | 132 | #### EpubIn 133 | 134 | ```cs 135 | /// 136 | /// http://idpf.org/epub 137 | /// 138 | public class EpubIn : 139 | InOptions 140 | { 141 | protected override string Format => "epub"; 142 | } 143 | ``` 144 | 145 | 146 | #### Fib2In 147 | 148 | ```cs 149 | /// 150 | /// http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1 151 | /// 152 | public class Fib2In : 153 | InOptions 154 | { 155 | protected override string Format => "fb2"; 156 | } 157 | ``` 158 | 159 | 160 | #### GhMdIn 161 | 162 | ```cs 163 | /// 164 | /// https://help.github.com/articles/github-flavored-markdown/ 165 | /// 166 | public class GhMdIn : 167 | InOptions 168 | { 169 | protected override string Format => "gfm"; 170 | } 171 | ``` 172 | 173 | 174 | #### HaddockIn 175 | 176 | ```cs 177 | /// 178 | /// https://www.haskell.org/haddock/doc/html/ch03s08.html 179 | /// 180 | public class HaddockIn : 181 | InOptions 182 | { 183 | protected override string Format => "haddock"; 184 | } 185 | ``` 186 | 187 | 188 | #### HaskellIn 189 | 190 | ```cs 191 | public class HaskellIn : 192 | InOptions 193 | { 194 | protected override string Format => "native"; 195 | } 196 | ``` 197 | 198 | 199 | #### HtmlIn 200 | 201 | ```cs 202 | public class HtmlIn : 203 | InOptions 204 | { 205 | protected override string Format => "html"; 206 | } 207 | ``` 208 | 209 | 210 | #### InOptions 211 | 212 | ```cs 213 | public abstract class InOptions 214 | { 215 | /// 216 | /// Shift heading levels by a positive or negative integer 217 | /// https://pandoc.org/MANUAL.html#option--shift-heading-level-by 218 | /// 219 | public int ShiftHeadingLevelBy { get; set; } 220 | /// 221 | /// Specify the number of spaces per tab (default is 4). 222 | /// https://pandoc.org/MANUAL.html#option--tab-stop 223 | /// 224 | public int? TabStop { get; set; } 225 | /// 226 | /// Specify classes to use for indented code blocks 227 | /// https://pandoc.org/MANUAL.html#option--indented-code-classes 228 | /// 229 | public IList? IndentedCodeClasses { get; set; } 230 | /// 231 | /// Parse each file individually before combining for multifile documents 232 | /// https://pandoc.org/MANUAL.html#option--file-scope 233 | /// 234 | public bool FileScope { get; set; } 235 | /// 236 | /// Preserve tabs instead of converting them to spaces. (By default, pandoc converts tabs to spaces before parsing its input.) 237 | /// https://pandoc.org/MANUAL.html#option--preserve-tabs 238 | /// 239 | public bool PreserveTabs { get; set; } 240 | /// 241 | /// Specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written. The executable should read JSON from stdin and write JSON to stdout 242 | /// https://pandoc.org/MANUAL.html#option--filter 243 | /// 244 | public string? Filter { get; set; } 245 | /// 246 | /// Transform the document in a similar fashion as JSON filters (see --filter), but use pandoc’s built-in Lua filtering system. 247 | /// https://pandoc.org/MANUAL.html#option--lua-filter 248 | /// 249 | public string? LuaFilter { get; set; } 250 | //TODO:--metadata 251 | /// 252 | /// Set the metadata field KEY to the value VAL. A value specified on the command line overrides a value specified in the document using YAML metadata blocks. Values will be parsed as YAML boolean or string values. If no value is specified, the value will be treated as Boolean true. 253 | /// https://pandoc.org/MANUAL.html#option--metadata 254 | /// 255 | public string? Metadata { get; set; } 256 | /// 257 | /// Extract images and other media contained in or linked from the source document to the path DIR, creating it if necessary, and adjust the images references in the document so they point to the extracted files. 258 | /// https://pandoc.org/MANUAL.html#option--extract-media 259 | /// 260 | public string? ExtractMedia{ get; set; } 261 | /// 262 | /// Specifies a custom abbreviations file, with abbreviations one to a line. 263 | /// https://pandoc.org/MANUAL.html#option--abbreviations 264 | /// 265 | public string? Abbreviations{ get; set; } 266 | 267 | protected abstract string Format { get; } 268 | 269 | public virtual IEnumerable GetArguments() 270 | { 271 | yield return $"--from={Format}"; 272 | 273 | if (ShiftHeadingLevelBy != 0) 274 | { 275 | yield return $"--shift-heading-level-by={ShiftHeadingLevelBy}"; 276 | } 277 | 278 | if (IndentedCodeClasses != null) 279 | { 280 | yield return $"--indented-code-classes={string.Join(",", IndentedCodeClasses)}"; 281 | } 282 | 283 | if (FileScope) 284 | { 285 | yield return "file-scope"; 286 | } 287 | 288 | if (Filter != null) 289 | { 290 | yield return $"--filter={Filter}"; 291 | } 292 | 293 | if (LuaFilter != null) 294 | { 295 | yield return $"--lua-filter={LuaFilter}"; 296 | } 297 | 298 | if (Metadata != null) 299 | { 300 | yield return $"--metadata-file={Metadata}"; 301 | } 302 | 303 | if (PreserveTabs) 304 | { 305 | yield return "--preserve-tabs"; 306 | } 307 | 308 | if (TabStop != null) 309 | { 310 | yield return $"--tab-stop={TabStop}"; 311 | } 312 | 313 | if (ExtractMedia != null) 314 | { 315 | yield return $"--extract-media={ExtractMedia}"; 316 | } 317 | 318 | if (Abbreviations != null) 319 | { 320 | yield return $"--abbreviations={Abbreviations}"; 321 | } 322 | } 323 | } 324 | ``` 325 | 326 | 327 | #### JatsIn 328 | 329 | ```cs 330 | /// 331 | /// https://jats.nlm.nih.gov/ 332 | /// 333 | public class JatsIn : 334 | InOptions 335 | { 336 | protected override string Format => "jats"; 337 | } 338 | ``` 339 | 340 | 341 | #### JiraIn 342 | 343 | ```cs 344 | /// 345 | /// https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all 346 | /// 347 | public class JiraIn : 348 | InOptions 349 | { 350 | protected override string Format => "jira"; 351 | } 352 | ``` 353 | 354 | 355 | #### JsonIn 356 | 357 | ```cs 358 | public class JsonIn : 359 | InOptions 360 | { 361 | protected override string Format => "json"; 362 | } 363 | ``` 364 | 365 | 366 | #### JupyterIn 367 | 368 | ```cs 369 | /// 370 | /// https://nbformat.readthedocs.io/en/latest/ 371 | /// 372 | public class JupyterIn : 373 | InOptions 374 | { 375 | protected override string Format => "ipynb"; 376 | } 377 | ``` 378 | 379 | 380 | #### LaTexIn 381 | 382 | ```cs 383 | /// 384 | /// https://www.latex-project.org/ 385 | /// 386 | public class LaTexIn : 387 | InOptions 388 | { 389 | /// 390 | /// Specify a default extension to use when image paths/URLs have no extension 391 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 392 | /// 393 | public string? DefaultImageExtension { get; set; } 394 | 395 | public override IEnumerable GetArguments() 396 | { 397 | foreach (var argument in base.GetArguments()) 398 | { 399 | yield return argument; 400 | } 401 | 402 | if (DefaultImageExtension != null) 403 | { 404 | yield return $"--default-image-extension={DefaultImageExtension}"; 405 | } 406 | } 407 | 408 | protected override string Format => "latex"; 409 | } 410 | ``` 411 | 412 | 413 | #### MediaWikiIn 414 | 415 | ```cs 416 | /// 417 | /// https://www.mediawiki.org/wiki/Help:Formatting 418 | /// 419 | public class MediaWikiIn : 420 | InOptions 421 | { 422 | protected override string Format => "mediawiki"; 423 | } 424 | ``` 425 | 426 | 427 | #### MuseIn 428 | 429 | ```cs 430 | /// 431 | /// https://amusewiki.org/library/manual 432 | /// 433 | public class MuseIn : 434 | InOptions 435 | { 436 | protected override string Format => "muse"; 437 | } 438 | ``` 439 | 440 | 441 | #### OdtIn 442 | 443 | ```cs 444 | /// 445 | /// https://en.wikipedia.org/wiki/OpenDocument 446 | /// 447 | public class OdtIn : 448 | InOptions 449 | { 450 | protected override string Format => "odt"; 451 | } 452 | ``` 453 | 454 | 455 | #### OpmlIn 456 | 457 | ```cs 458 | /// 459 | /// http://opml.org/spec2.opml 460 | /// 461 | public class OpmlIn : 462 | InOptions 463 | { 464 | protected override string Format => "opml"; 465 | } 466 | ``` 467 | 468 | 469 | #### RoffManIn 470 | 471 | ```cs 472 | /// 473 | /// https://man.cx/groff_man(7) 474 | /// 475 | public class RoffManIn : 476 | InOptions 477 | { 478 | protected override string Format => "man"; 479 | } 480 | ``` 481 | 482 | 483 | #### RstIn 484 | 485 | ```cs 486 | /// 487 | /// https://docutils.sourceforge.io/docs/ref/rst/introduction.html 488 | /// 489 | public class RstIn : 490 | InOptions 491 | { 492 | protected override string Format => "rst"; 493 | } 494 | ``` 495 | 496 | 497 | #### RtfIn 498 | 499 | ```cs 500 | /// 501 | /// https://en.wikipedia.org/wiki/Rich_Text_Format 502 | /// 503 | public class RtfIn : 504 | InOptions 505 | { 506 | protected override string Format => "rtf"; 507 | } 508 | ``` 509 | 510 | 511 | #### T2tIn 512 | 513 | ```cs 514 | /// 515 | /// https://txt2tags.org/ 516 | /// 517 | public class T2tIn : 518 | InOptions 519 | { 520 | protected override string Format => "t2t"; 521 | } 522 | ``` 523 | 524 | 525 | #### TextileIn 526 | 527 | ```cs 528 | /// 529 | /// https://www.promptworks.com/textile 530 | /// 531 | public class TextileIn : 532 | InOptions 533 | { 534 | protected override string Format => "textile"; 535 | } 536 | ``` 537 | 538 | 539 | #### TikiWikiIn 540 | 541 | ```cs 542 | /// 543 | /// https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules 544 | /// 545 | public class TikiWikiIn : 546 | InOptions 547 | { 548 | protected override string Format => "tikiwiki"; 549 | } 550 | ``` 551 | 552 | 553 | #### TrackChanges 554 | 555 | ```cs 556 | public enum TrackChanges 557 | { 558 | Accept, 559 | Reject, 560 | All 561 | } 562 | ``` 563 | 564 | 565 | #### TWikiIn 566 | 567 | ```cs 568 | /// 569 | /// https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules 570 | /// 571 | public class TWikiIn : 572 | InOptions 573 | { 574 | protected override string Format => "twiki"; 575 | } 576 | ``` 577 | 578 | 579 | #### VimWikiIn 580 | 581 | ```cs 582 | /// 583 | /// https://vimwiki.github.io/ 584 | /// 585 | public class VimWikiIn : 586 | InOptions 587 | { 588 | protected override string Format => "vimwiki"; 589 | } 590 | ``` 591 | 592 | 593 | #### CommonMarkIn 594 | 595 | ```cs 596 | /// 597 | /// https://commonmark.org/ 598 | /// 599 | public class CommonMarkIn : 600 | InOptions 601 | { 602 | protected override string Format => "commonmark"; 603 | 604 | /// 605 | /// Specify a default extension to use when image paths/URLs have no extension 606 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 607 | /// 608 | public string? DefaultImageExtension { get; set; } 609 | 610 | public override IEnumerable GetArguments() 611 | { 612 | foreach (var argument in base.GetArguments()) 613 | { 614 | yield return argument; 615 | } 616 | 617 | if (DefaultImageExtension != null) 618 | { 619 | yield return $"--default-image-extension={DefaultImageExtension}"; 620 | } 621 | } 622 | } 623 | ``` 624 | 625 | 626 | #### CommonMarkXIn 627 | 628 | ```cs 629 | /// 630 | /// https://commonmark.org/ 631 | /// 632 | public class CommonMarkXIn : 633 | InOptions 634 | { 635 | protected override string Format => "commonmark_x"; 636 | 637 | /// 638 | /// Specify a default extension to use when image paths/URLs have no extension 639 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 640 | /// 641 | public string? DefaultImageExtension { get; set; } 642 | 643 | public override IEnumerable GetArguments() 644 | { 645 | foreach (var argument in base.GetArguments()) 646 | { 647 | yield return argument; 648 | } 649 | 650 | if (DefaultImageExtension != null) 651 | { 652 | yield return $"--default-image-extension={DefaultImageExtension}"; 653 | } 654 | } 655 | } 656 | ``` 657 | 658 | 659 | #### MdStrictIn 660 | 661 | ```cs 662 | /// 663 | /// https://daringfireball.net/projects/markdown/ 664 | /// 665 | public class MdStrictIn : 666 | InOptions 667 | { 668 | protected override string Format => "markdown_strict"; 669 | 670 | /// 671 | /// Specify a default extension to use when image paths/URLs have no extension 672 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 673 | /// 674 | public string? DefaultImageExtension { get; set; } 675 | 676 | public override IEnumerable GetArguments() 677 | { 678 | foreach (var argument in base.GetArguments()) 679 | { 680 | yield return argument; 681 | } 682 | 683 | if (DefaultImageExtension != null) 684 | { 685 | yield return $"--default-image-extension={DefaultImageExtension}"; 686 | } 687 | } 688 | } 689 | ``` 690 | 691 | 692 | #### MultiMdIn 693 | 694 | ```cs 695 | /// 696 | /// https://fletcherpenney.net/multimarkdown/ 697 | /// 698 | public class MultiMdIn : 699 | InOptions 700 | { 701 | protected override string Format => "markdown_mmd"; 702 | 703 | /// 704 | /// Specify a default extension to use when image paths/URLs have no extension 705 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 706 | /// 707 | public string? DefaultImageExtension { get; set; } 708 | 709 | public override IEnumerable GetArguments() 710 | { 711 | foreach (var argument in base.GetArguments()) 712 | { 713 | yield return argument; 714 | } 715 | 716 | if (DefaultImageExtension != null) 717 | { 718 | yield return $"--default-image-extension={DefaultImageExtension}"; 719 | } 720 | } 721 | } 722 | ``` 723 | 724 | 725 | #### PandocMdIn 726 | 727 | ```cs 728 | /// 729 | /// https://pandoc.org/MANUAL.html#pandocs-markdown 730 | /// 731 | public class PandocMdIn : 732 | InOptions 733 | { 734 | protected override string Format => "markdown"; 735 | 736 | /// 737 | /// Specify a default extension to use when image paths/URLs have no extension 738 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 739 | /// 740 | public string? DefaultImageExtension { get; set; } 741 | 742 | public override IEnumerable GetArguments() 743 | { 744 | foreach (var argument in base.GetArguments()) 745 | { 746 | yield return argument; 747 | } 748 | 749 | if (DefaultImageExtension != null) 750 | { 751 | yield return $"--default-image-extension={DefaultImageExtension}"; 752 | } 753 | } 754 | } 755 | ``` 756 | 757 | 758 | #### PhpMdExtraIn 759 | 760 | ```cs 761 | /// 762 | /// https://michelf.ca/projects/php-markdown/extra/ 763 | /// 764 | public class PhpMdExtraIn : 765 | InOptions 766 | { 767 | protected override string Format => "markdown_phpextra"; 768 | 769 | /// 770 | /// Specify a default extension to use when image paths/URLs have no extension 771 | /// https://pandoc.org/MANUAL.html#option--default-image-extension 772 | /// 773 | public string? DefaultImageExtension { get; set; } 774 | 775 | public override IEnumerable GetArguments() 776 | { 777 | foreach (var argument in base.GetArguments()) 778 | { 779 | yield return argument; 780 | } 781 | 782 | if (DefaultImageExtension != null) 783 | { 784 | yield return $"--default-image-extension={DefaultImageExtension}"; 785 | } 786 | } 787 | } 788 | ``` 789 | 790 | 791 | -------------------------------------------------------------------------------- /src/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCropp/PandocNet/295ab482693bc70498dcf54673750a3d7a3e0a92/src/key.snk -------------------------------------------------------------------------------- /src/mdsnippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json", 3 | "TocExcludes": [ "NuGet package", "Release Notes", "Icon" ], 4 | "MaxWidth": 100, 5 | "ValidateContent": true, 6 | "Convention": "InPlaceOverwrite" 7 | } -------------------------------------------------------------------------------- /src/nuget.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 20 | 21 | 24 | 25 | 26 | --------------------------------------------------------------------------------