Compare commits
25 commits
Author | SHA1 | Date | |
---|---|---|---|
D. Moonfire | 5229ab8521 | ||
D. Moonfire | e6e565f000 | ||
D. Moonfire | 061511a9ed | ||
D. Moonfire | 2ea1905fac | ||
D. Moonfire | 83936c750c | ||
D. Moonfire | 3f959ff743 | ||
D. Moonfire | 6f84da0b02 | ||
D. Moonfire | cd9c8989dc | ||
D. Moonfire | 45f26437ff | ||
D. Moonfire | ffe97e8eff | ||
D. Moonfire | 768fde0201 | ||
D. Moonfire | 4089e994fb | ||
D. Moonfire | 341fbb071c | ||
D. Moonfire | 16880cb36e | ||
D. Moonfire | e9fa2f6ce7 | ||
D. Moonfire | aa1eae40e0 | ||
D. Moonfire | 152428b235 | ||
D. Moonfire | 962e1f0d11 | ||
D. Moonfire | 0603603be0 | ||
D. Moonfire | 294d9c0a38 | ||
D. Moonfire | 4093d9c0cb | ||
D. Moonfire | f3b18dc54a | ||
f53405b55e | |||
5c25b24720 | |||
0649c62685 |
18
.config/dotnet-tools.json
Normal file
18
.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"gitversion.tool": {
|
||||||
|
"version": "5.9.0",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-gitversion"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-reportgenerator-globaltool": {
|
||||||
|
"version": "5.1.3",
|
||||||
|
"commands": [
|
||||||
|
"reportgenerator"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
198
.editorconfig
198
.editorconfig
|
@ -3,120 +3,120 @@
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset=utf-8
|
charset = utf-8
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline=true
|
insert_final_newline = true
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=4
|
indent_size = 4
|
||||||
|
|
||||||
# Microsoft .NET properties
|
# Microsoft .NET properties
|
||||||
csharp_new_line_before_members_in_object_initializers=false
|
csharp_new_line_before_members_in_object_initializers = false
|
||||||
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
||||||
csharp_space_after_cast=false
|
csharp_space_after_cast = false
|
||||||
csharp_style_var_elsewhere=false:hint
|
csharp_style_var_elsewhere = false:hint
|
||||||
csharp_style_var_for_built_in_types=false:hint
|
csharp_style_var_for_built_in_types = false:hint
|
||||||
csharp_style_var_when_type_is_apparent=true:hint
|
csharp_style_var_when_type_is_apparent = true:hint
|
||||||
csharp_preserve_single_line_statements=false
|
csharp_preserve_single_line_statements = false
|
||||||
csharp_preserve_single_line_blocks=true
|
csharp_preserve_single_line_blocks = true
|
||||||
dotnet_style_predefined_type_for_locals_parameters_members=true:hint
|
dotnet_style_predefined_type_for_locals_parameters_members = true:hint
|
||||||
dotnet_style_predefined_type_for_member_access=true:hint
|
dotnet_style_predefined_type_for_member_access = true:hint
|
||||||
dotnet_style_qualification_for_event=true:hint
|
dotnet_style_qualification_for_event = true:hint
|
||||||
dotnet_style_qualification_for_field=true:hint
|
dotnet_style_qualification_for_field = true:hint
|
||||||
dotnet_style_qualification_for_method=true:hint
|
dotnet_style_qualification_for_method = true:hint
|
||||||
dotnet_style_qualification_for_property=true:hint
|
dotnet_style_qualification_for_property = true:hint
|
||||||
dotnet_style_require_accessibility_modifiers=for_non_interface_members:hint
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:hint
|
||||||
|
|
||||||
# ReSharper properties
|
# ReSharper properties
|
||||||
resharper_alignment_tab_fill_style=optimal_fill
|
resharper_alignment_tab_fill_style = optimal_fill
|
||||||
resharper_apply_on_completion=true
|
resharper_apply_on_completion = true
|
||||||
resharper_blank_lines_after_control_transfer_statements=1
|
resharper_blank_lines_after_control_transfer_statements = 1
|
||||||
resharper_blank_lines_around_single_line_auto_property=1
|
resharper_blank_lines_around_single_line_auto_property = 1
|
||||||
resharper_blank_lines_around_single_line_property=1
|
resharper_blank_lines_around_single_line_property = 1
|
||||||
resharper_blank_lines_before_single_line_comment=1
|
resharper_blank_lines_before_single_line_comment = 1
|
||||||
resharper_blank_lines_between_using_groups=1
|
resharper_blank_lines_between_using_groups = 1
|
||||||
resharper_braces_for_for=required
|
resharper_braces_for_for = required
|
||||||
resharper_braces_for_foreach=required
|
resharper_braces_for_foreach = required
|
||||||
resharper_braces_for_ifelse=required
|
resharper_braces_for_ifelse = required
|
||||||
resharper_braces_for_while=required
|
resharper_braces_for_while = required
|
||||||
resharper_can_use_global_alias=false
|
resharper_can_use_global_alias = false
|
||||||
resharper_csharp_blank_lines_around_single_line_field=1
|
resharper_csharp_blank_lines_around_single_line_field = 1
|
||||||
resharper_csharp_blank_lines_around_single_line_invocable=1
|
resharper_csharp_blank_lines_around_single_line_invocable = 1
|
||||||
resharper_csharp_indent_style=tab
|
resharper_csharp_indent_style = tab
|
||||||
resharper_csharp_insert_final_newline=true
|
resharper_csharp_insert_final_newline = true
|
||||||
resharper_csharp_keep_blank_lines_in_code=1
|
resharper_csharp_keep_blank_lines_in_code = 1
|
||||||
resharper_csharp_keep_blank_lines_in_declarations=1
|
resharper_csharp_keep_blank_lines_in_declarations = 1
|
||||||
resharper_csharp_new_line_before_while=true
|
resharper_csharp_new_line_before_while = true
|
||||||
resharper_csharp_use_indent_from_vs=false
|
resharper_csharp_use_indent_from_vs = false
|
||||||
resharper_csharp_wrap_arguments_style=chop_if_long
|
resharper_csharp_wrap_arguments_style = chop_if_long
|
||||||
resharper_csharp_wrap_extends_list_style=chop_if_long
|
resharper_csharp_wrap_extends_list_style = chop_if_long
|
||||||
resharper_csharp_wrap_parameters_style=chop_if_long
|
resharper_csharp_wrap_parameters_style = chop_if_long
|
||||||
resharper_css_insert_final_newline=false
|
resharper_css_insert_final_newline = false
|
||||||
resharper_enforce_line_ending_style=true
|
resharper_enforce_line_ending_style = true
|
||||||
resharper_html_insert_final_newline=false
|
resharper_html_insert_final_newline = false
|
||||||
resharper_indent_nested_fixed_stmt=true
|
resharper_indent_nested_fixed_stmt = true
|
||||||
resharper_js_indent_style=tab
|
resharper_js_indent_style = tab
|
||||||
resharper_js_insert_final_newline=true
|
resharper_js_insert_final_newline = true
|
||||||
resharper_js_keep_blank_lines_in_code=1
|
resharper_js_keep_blank_lines_in_code = 1
|
||||||
resharper_js_stick_comment=false
|
resharper_js_stick_comment = false
|
||||||
resharper_js_use_indent_from_vs=false
|
resharper_js_use_indent_from_vs = false
|
||||||
resharper_js_wrap_before_binary_opsign=true
|
resharper_js_wrap_before_binary_opsign = true
|
||||||
resharper_js_wrap_chained_method_calls=chop_if_long
|
resharper_js_wrap_chained_method_calls = chop_if_long
|
||||||
resharper_keep_blank_lines_between_declarations=1
|
resharper_keep_blank_lines_between_declarations = 1
|
||||||
resharper_min_blank_lines_after_imports=1
|
resharper_min_blank_lines_after_imports = 1
|
||||||
resharper_place_attribute_on_same_line=False
|
resharper_place_attribute_on_same_line = False
|
||||||
resharper_place_constructor_initializer_on_same_line=false
|
resharper_place_constructor_initializer_on_same_line = false
|
||||||
resharper_place_type_constraints_on_same_line=false
|
resharper_place_type_constraints_on_same_line = false
|
||||||
resharper_protobuf_insert_final_newline=false
|
resharper_protobuf_insert_final_newline = false
|
||||||
resharper_qualified_using_at_nested_scope=true
|
resharper_qualified_using_at_nested_scope = true
|
||||||
resharper_resx_insert_final_newline=false
|
resharper_resx_insert_final_newline = false
|
||||||
resharper_space_within_single_line_array_initializer_braces=true
|
resharper_space_within_single_line_array_initializer_braces = true
|
||||||
resharper_use_indents_from_main_language_in_file=false
|
resharper_use_indents_from_main_language_in_file = false
|
||||||
resharper_vb_insert_final_newline=false
|
resharper_vb_insert_final_newline = false
|
||||||
resharper_wrap_after_declaration_lpar=true
|
resharper_wrap_after_declaration_lpar = true
|
||||||
resharper_wrap_after_invocation_lpar=true
|
resharper_wrap_after_invocation_lpar = true
|
||||||
resharper_wrap_before_extends_colon=true
|
resharper_wrap_before_extends_colon = true
|
||||||
resharper_wrap_before_first_type_parameter_constraint=true
|
resharper_wrap_before_first_type_parameter_constraint = true
|
||||||
resharper_wrap_before_type_parameter_langle=true
|
resharper_wrap_before_type_parameter_langle = true
|
||||||
resharper_xmldoc_indent_child_elements=ZeroIndent
|
resharper_xmldoc_indent_child_elements = ZeroIndent
|
||||||
resharper_xmldoc_indent_text=ZeroIndent
|
resharper_xmldoc_indent_text = ZeroIndent
|
||||||
resharper_xmldoc_insert_final_newline=false
|
resharper_xmldoc_insert_final_newline = false
|
||||||
resharper_xml_insert_final_newline=false
|
resharper_xml_insert_final_newline = false
|
||||||
|
|
||||||
# ReSharper inspection severities
|
# ReSharper inspection severities
|
||||||
resharper_check_namespace_highlighting=none
|
resharper_check_namespace_highlighting = none
|
||||||
resharper_convert_to_auto_property_highlighting=none
|
resharper_convert_to_auto_property_highlighting = none
|
||||||
resharper_localizable_element_highlighting=none
|
resharper_localizable_element_highlighting = none
|
||||||
resharper_redundant_comma_in_attribute_list_highlighting=none
|
resharper_redundant_comma_in_attribute_list_highlighting = none
|
||||||
resharper_redundant_comma_in_enum_declaration_highlighting=none
|
resharper_redundant_comma_in_enum_declaration_highlighting = none
|
||||||
resharper_redundant_comma_in_initializer_highlighting=none
|
resharper_redundant_comma_in_initializer_highlighting = none
|
||||||
resharper_string_compare_to_is_culture_specific_highlighting=none
|
resharper_string_compare_to_is_culture_specific_highlighting = none
|
||||||
resharper_string_index_of_is_culture_specific_1_highlighting=none
|
resharper_string_index_of_is_culture_specific_1_highlighting = none
|
||||||
resharper_use_null_propagation_highlighting=none
|
resharper_use_null_propagation_highlighting = none
|
||||||
resharper_use_object_or_collection_initializer_highlighting=hint
|
resharper_use_object_or_collection_initializer_highlighting = hint
|
||||||
resharper_use_string_interpolation_highlighting=hint
|
resharper_use_string_interpolation_highlighting = hint
|
||||||
|
|
||||||
# Matches the exact files either package.json or .travis.yml
|
# Matches the exact files either package.json or .travis.yml
|
||||||
[{package.json,.travis.yml}]
|
[{package.json,.travis.yml}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=2
|
indent_size = 2
|
||||||
tab_width=2
|
tab_width = 2
|
||||||
|
|
||||||
[*.{cs,js,json,jsx,proto,resjson,ts,tsx}]
|
[*.{cs,js,json,jsx,proto,resjson,ts,tsx}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=space
|
indent_size = 4
|
||||||
tab_width=4
|
tab_width = 4
|
||||||
|
|
||||||
[*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}]
|
[*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=4
|
indent_size = 4
|
||||||
tab_width=4
|
tab_width = 4
|
||||||
|
|
||||||
[*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
|
[*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=2
|
indent_size = 2
|
||||||
tab_width=2
|
tab_width = 2
|
||||||
|
|
||||||
[*.proto]
|
[*.proto]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=2
|
indent_size = 2
|
||||||
tab_width=2
|
tab_width = 2
|
||||||
|
|
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -11,9 +11,15 @@ obj/
|
||||||
.idea/
|
.idea/
|
||||||
_ReSharper.Caches/
|
_ReSharper.Caches/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
# NixOS
|
||||||
.direnv/
|
.direnv/
|
||||||
coverage/
|
|
||||||
tests/artifacts/
|
# Tests and Coverage
|
||||||
|
coverage
|
||||||
TestResults/
|
TestResults/
|
||||||
.config/
|
tests/artifacts/
|
||||||
.direnv/
|
|
||||||
|
# Lefthook
|
||||||
|
.lefthook-local/
|
||||||
|
lefthook-local.yml
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
|
|
||||||
default:
|
|
||||||
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
|
||||||
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- nix develop --command scripts/ci-build.sh
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH
|
|
||||||
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- nix develop --command scripts/ci-test.sh
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH
|
|
||||||
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
|
||||||
artifacts:
|
|
||||||
when: always
|
|
||||||
paths:
|
|
||||||
- ./**/*test-result.xml
|
|
||||||
- ./coverage/Cobertura.xml
|
|
||||||
- ./coverage/Summary.*
|
|
||||||
- ./**/*.nupkg
|
|
||||||
reports:
|
|
||||||
junit:
|
|
||||||
- ./**/*test-result.xml
|
|
||||||
cobertura:
|
|
||||||
- ./coverage/Cobertura.xml
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- nix develop --command scripts/ci-release.sh
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
8
.prettierignore
Normal file
8
.prettierignore
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
*~
|
||||||
|
flake.*
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
.direnv/
|
||||||
|
.config/
|
||||||
|
obj/
|
||||||
|
bin/
|
30
.woodpecker.yml
Normal file
30
.woodpecker.yml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||||
|
commands:
|
||||||
|
- nix develop --command scripts/build.sh
|
||||||
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||||
|
commands:
|
||||||
|
- nix develop --command scripts/test.sh
|
||||||
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
|
|
||||||
|
release-main:
|
||||||
|
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||||
|
commands:
|
||||||
|
- nix develop --command scripts/release.sh
|
||||||
|
secrets:
|
||||||
|
- gitea_token
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: main
|
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,19 +0,0 @@
|
||||||
# [1.1.0](https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil/compare/v1.0.0...v1.1.0) (2022-02-16)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* added table rendering ([6fac646](https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil/commit/6fac646f189fdcc061c868b99e4f1174c08033ec))
|
|
||||||
|
|
||||||
# 1.0.0 (2021-09-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **test:** adding coverage test ([9250289](https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil/commit/925028984d782fc8f7a9a90812a6a57ae90cc617))
|
|
||||||
* correcting references and NuGet metadata ([de17b4a](https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil/commit/de17b4a75b3eed733f36032365d0f21d6a02e955))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* initial commit ([9fe90f8](https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil/commit/9fe90f820c7333d5cbc9b74cb301e64849ec21ca))
|
|
132
CODE-OF-CONDUCT.md
Normal file
132
CODE-OF-CONDUCT.md
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||||
|
identity and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
- Demonstrating empathy and kindness toward other people
|
||||||
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
- Giving and gracefully accepting constructive feedback
|
||||||
|
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
- Focusing on what is best not just for us as individuals, but for the overall
|
||||||
|
community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery, and sexual attention or advances of
|
||||||
|
any kind
|
||||||
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
- Public or private harassment
|
||||||
|
- Publishing others' private information, such as a physical or email address,
|
||||||
|
without their explicit permission
|
||||||
|
- Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
[INSERT CONTACT METHOD].
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series of
|
||||||
|
actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or permanent
|
||||||
|
ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||||
|
community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.1, available at
|
||||||
|
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by
|
||||||
|
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
|
||||||
|
[https://www.contributor-covenant.org/translations][translations].
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||||
|
[mozilla coc]: https://github.com/mozilla/diversity
|
||||||
|
[faq]: https://www.contributor-covenant.org/faq
|
||||||
|
[translations]: https://www.contributor-covenant.org/translations
|
|
@ -1,54 +1,86 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26124.0
|
VisualStudioVersion = 15.0.26124.0
|
||||||
MinimumVisualStudioVersion = 15.0.26124.0
|
MinimumVisualStudioVersion = 15.0.26124.0
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{954BA984-D50E-4D1C-880F-EAE678EF6945}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{954BA984-D50E-4D1C-880F-EAE678EF6945}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Markdown.Gemtext", "src\MfGames.Markdown.Gemtext\MfGames.Markdown.Gemtext.csproj", "{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Markdown.Gemtext", "src\MfGames.Markdown.Gemtext\MfGames.Markdown.Gemtext.csproj", "{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Markdown.Gemtext.Tests", "src\MfGames.Markdown.Gemtext.Tests\MfGames.Markdown.Gemtext.Tests.csproj", "{D2703B25-9AF7-49FF-93A4-CB124560F2A9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Markdown.Gemtext.Tests", "tests\MfGames.Markdown.Gemtext.Tests\MfGames.Markdown.Gemtext.Tests.csproj", "{D2703B25-9AF7-49FF-93A4-CB124560F2A9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{B4837F83-8560-4AC9-B1E3-6B8C0545A65B}"
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
EndProject
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Markdown", "src\MfGames.Markdown\MfGames.Markdown.csproj", "{482E332F-9E72-4F02-B528-9CF04AE05E82}"
|
||||||
Debug|x64 = Debug|x64
|
EndProject
|
||||||
Debug|x86 = Debug|x86
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Markdown.Tests", "tests\MfGames.Markdown.Tests\MfGames.Markdown.Tests.csproj", "{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}"
|
||||||
Release|Any CPU = Release|Any CPU
|
EndProject
|
||||||
Release|x64 = Release|x64
|
Global
|
||||||
Release|x86 = Release|x86
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
EndGlobalSection
|
Debug|Any CPU = Debug|Any CPU
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
Debug|x64 = Debug|x64
|
||||||
HideSolutionNode = FALSE
|
Debug|x86 = Debug|x86
|
||||||
EndGlobalSection
|
Release|Any CPU = Release|Any CPU
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
Release|x64 = Release|x64
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
Release|x86 = Release|x86
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
EndGlobalSection
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x64.Build.0 = Debug|Any CPU
|
HideSolutionNode = FALSE
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
EndGlobalSection
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x86.Build.0 = Debug|Any CPU
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x64.ActiveCfg = Release|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x64.Build.0 = Release|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x86.ActiveCfg = Release|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x86.Build.0 = Release|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x64.Build.0 = Debug|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x86.Build.0 = Debug|Any CPU
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x64.ActiveCfg = Release|Any CPU
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x64.Build.0 = Release|Any CPU
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x86.ActiveCfg = Release|Any CPU
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x86.Build.0 = Release|Any CPU
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
GlobalSection(NestedProjects) = preSolution
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA} = {954BA984-D50E-4D1C-880F-EAE678EF6945}
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{D2703B25-9AF7-49FF-93A4-CB124560F2A9} = {954BA984-D50E-4D1C-880F-EAE678EF6945}
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
EndGlobal
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{2A1DE43D-544D-4CE0-ACC8-D15497BBCECA} = {954BA984-D50E-4D1C-880F-EAE678EF6945}
|
||||||
|
{D2703B25-9AF7-49FF-93A4-CB124560F2A9} = {B4837F83-8560-4AC9-B1E3-6B8C0545A65B}
|
||||||
|
{482E332F-9E72-4F02-B528-9CF04AE05E82} = {954BA984-D50E-4D1C-880F-EAE678EF6945}
|
||||||
|
{3E2AD98D-D1A1-48DF-B94F-A470982DAC9B} = {B4837F83-8560-4AC9-B1E3-6B8C0545A65B}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
16
NuGet.Config
Normal file
16
NuGet.Config
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<clear />
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
|
<add key="mfgames.com" value="https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json" protocolVersion="3" />
|
||||||
|
</packageSources>
|
||||||
|
<packageSourceMapping>
|
||||||
|
<packageSource key="nuget.org">
|
||||||
|
<package pattern="*" />
|
||||||
|
</packageSource>
|
||||||
|
<packageSource key="mfgames.com">
|
||||||
|
<package pattern="MfGames.*" />
|
||||||
|
</packageSource>
|
||||||
|
</packageSourceMapping>
|
||||||
|
</configuration>
|
40
README.md
40
README.md
|
@ -1,4 +1,38 @@
|
||||||
MfGames.Markdown.Gemtext CIL
|
# MfGames.Markdown CIL
|
||||||
============================
|
|
||||||
|
|
||||||
An extension for [Markdig](https://github.com/xoofx/markdig) that converts Markdown into Gemtext.
|
This is a set of libraries for working with Markdown in C#. Most of the code are extensions in [MarkDig](https://github.com/xoofx/markdig), an extensible library for converting Markdown.
|
||||||
|
|
||||||
|
The library includes the following:
|
||||||
|
|
||||||
|
- An extension for converting wiki links, such as `[[MfGames]]` into a link based on the title. This is for both HTML and Gemtext.
|
||||||
|
- A output library for using MarkDig to generate Gemtext for Gemini pods.
|
||||||
|
|
||||||
|
The documentation is rather light at the moment, but the tests can show various ways of using the libraries.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
These library are not on nuget.org (for various reasons). To use them, set up your NuGet.config to pull them from their repository.
|
||||||
|
|
||||||
|
```
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<clear />
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
|
<add key="mfgames.com" value="https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json" protocolVersion="3" />
|
||||||
|
</packageSources>
|
||||||
|
<packageSourceMapping>
|
||||||
|
<packageSource key="nuget.org">
|
||||||
|
<package pattern="*" />
|
||||||
|
</packageSource>
|
||||||
|
<packageSource key="mfgames.com">
|
||||||
|
<package pattern="MfGames.*" />
|
||||||
|
</packageSource>
|
||||||
|
</packageSourceMapping>
|
||||||
|
</configuration>
|
||||||
|
```
|
||||||
|
|
||||||
|
The two libraries are:
|
||||||
|
|
||||||
|
- MfGames.Markdown
|
||||||
|
- MfGames.Markdown.Gemtext
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: ["@commitlint/config-conventional"],
|
|
||||||
rules: {
|
|
||||||
"body-max-line-length": [0],
|
|
||||||
},
|
|
||||||
};
|
|
12
flake.lock
12
flake.lock
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1638122382,
|
"lastModified": 1659877975,
|
||||||
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1638198142,
|
"lastModified": 1662019588,
|
||||||
"narHash": "sha256-plU9b8r4St6q4U7VHtG9V7oF8k9fIpfXl/KDaZLuY9k=",
|
"narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "8a308775674e178495767df90c419425474582a1",
|
"rev": "2da64a81275b68fdad38af669afeda43d401e94b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
11
flake.nix
11
flake.nix
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
description = "A .NET core library for building tools";
|
description = "A .NET core library for easily building CLI tools";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
@ -11,7 +11,14 @@
|
||||||
let pkgs = nixpkgs.legacyPackages.${system};
|
let pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in {
|
in {
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = [ pkgs.dotnet-sdk_5 pkgs.nodejs-16_x pkgs.nixfmt ];
|
buildInputs = [
|
||||||
|
pkgs.dotnet-sdk
|
||||||
|
pkgs.lefthook
|
||||||
|
pkgs.convco
|
||||||
|
pkgs.nodePackages.prettier
|
||||||
|
pkgs.nixfmt
|
||||||
|
pkgs.jq
|
||||||
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
22
lefthook.yml
Normal file
22
lefthook.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
pre-commit:
|
||||||
|
parallel: true
|
||||||
|
commands:
|
||||||
|
dotnet-format:
|
||||||
|
glob: "*.cs"
|
||||||
|
run: dotnet format
|
||||||
|
prettier:
|
||||||
|
run: prettier . --write --loglevel warn
|
||||||
|
nixfmt:
|
||||||
|
run: nixfmt flake.nix
|
||||||
|
|
||||||
|
commit-msg:
|
||||||
|
commands:
|
||||||
|
commit-check:
|
||||||
|
run: convco check -n 1
|
||||||
|
|
||||||
|
skip_output:
|
||||||
|
- meta # Skips lefthook version printing
|
||||||
|
- summary # Skips summary block (successful and failed steps) printing
|
||||||
|
- success # Skips successful steps printing
|
||||||
|
- failure # Skips failed steps printing
|
||||||
|
- execution # Skips printing successfully executed commands and their output (but still prints failed executions)
|
12310
package-lock.json
generated
12310
package-lock.json
generated
File diff suppressed because it is too large
Load diff
21
package.json
21
package.json
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"name": "mfgames-markdown-gemtext-cil",
|
|
||||||
"version": "1.1.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "husky install"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@commitlint/cli": "^13.1.0",
|
|
||||||
"@commitlint/config-conventional": "^13.1.0",
|
|
||||||
"@semantic-release/changelog": "^5.0.1",
|
|
||||||
"@semantic-release/git": "^9.0.0",
|
|
||||||
"@semantic-release/gitlab": "^6.2.2",
|
|
||||||
"@semantic-release/npm": "^7.1.3",
|
|
||||||
"commitlint-gitlab-ci": "^0.0.4",
|
|
||||||
"husky": "^7.0.2",
|
|
||||||
"semantic-release": "^17.4.7",
|
|
||||||
"semantic-release-dotnet": "^1.0.0",
|
|
||||||
"semantic-release-nuget": "^1.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: ["@commitlint/config-conventional"],
|
|
||||||
branches: ["main"],
|
|
||||||
message: "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
|
|
||||||
plugins: [
|
|
||||||
[
|
|
||||||
"@semantic-release/commit-analyzer",
|
|
||||||
{
|
|
||||||
"preset": "conventionalcommits",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@semantic-release/release-notes-generator",
|
|
||||||
"@semantic-release/npm",
|
|
||||||
[
|
|
||||||
"semantic-release-dotnet",
|
|
||||||
{
|
|
||||||
paths: ["src/Directory.Build.props"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"semantic-release-nuget",
|
|
||||||
{
|
|
||||||
packArguments: ["--include-symbols", "--include-source"],
|
|
||||||
pushFiles: ["src/*/bin/Debug/*.nupkg"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@semantic-release/changelog",
|
|
||||||
"@semantic-release/git",
|
|
||||||
"@semantic-release/gitlab",
|
|
||||||
],
|
|
||||||
};
|
|
23
scripts/README.md
Normal file
23
scripts/README.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Scripts Directory
|
||||||
|
|
||||||
|
This directory contains the basic scripts for working with the library.
|
||||||
|
|
||||||
|
## `setup.sh`
|
||||||
|
|
||||||
|
This verifies the environment is correct and makes sure everything is configured.
|
||||||
|
|
||||||
|
## `build.sh`
|
||||||
|
|
||||||
|
This builds the project and creates the binaries in debug mode.
|
||||||
|
|
||||||
|
## `test.sh`
|
||||||
|
|
||||||
|
This runs any required tests.
|
||||||
|
|
||||||
|
## `format.sh`
|
||||||
|
|
||||||
|
This is used to format the code base using our standards. It matches the commands in the `lefthook` pre-commit hook.
|
||||||
|
|
||||||
|
## `release.sh`
|
||||||
|
|
||||||
|
Intended to run in a CI environment, this creates a NuGet package and publishes it.
|
12
scripts/build.sh
Executable file
12
scripts/build.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Set up logging.
|
||||||
|
log() { echo "🛠️ $(basename $0): $@"; }
|
||||||
|
|
||||||
|
# Move into the top level.
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
log "building project"
|
||||||
|
dotnet build
|
|
@ -1,3 +0,0 @@
|
||||||
npm install --ci
|
|
||||||
dotnet restore
|
|
||||||
dotnet build
|
|
|
@ -1,5 +0,0 @@
|
||||||
npm install --ci
|
|
||||||
dotnet restore
|
|
||||||
dotnet build
|
|
||||||
npm install --ci
|
|
||||||
npx semantic-release
|
|
|
@ -1,9 +0,0 @@
|
||||||
npm install --ci
|
|
||||||
npx commitlint-gitlab-ci -x @commitlint/config-conventional
|
|
||||||
dotnet restore
|
|
||||||
dotnet build
|
|
||||||
dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"
|
|
||||||
dotnet new tool-manifest
|
|
||||||
dotnet tool install dotnet-reportgenerator-globaltool
|
|
||||||
dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
|
||||||
grep "Line coverage" coverage/Summary.txt
|
|
4
scripts/format.sh
Executable file
4
scripts/format.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
lefthook run pre-commit
|
55
scripts/release.sh
Executable file
55
scripts/release.sh
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Set up logging.
|
||||||
|
log() { echo "️🚢 $(basename $0): $@"; }
|
||||||
|
|
||||||
|
# Move into the root folder and make sure we're set up.
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
# Verify the input.
|
||||||
|
if [ "x$GITEA_TOKEN" = "x" ]
|
||||||
|
then
|
||||||
|
log "the environment variable GITEA_TOKEN is not defined"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up everything from the previous runs.
|
||||||
|
log "cleaning project"
|
||||||
|
dotnet clean
|
||||||
|
|
||||||
|
# Version the file based on the Git repository.
|
||||||
|
log "setting project version"
|
||||||
|
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
|
||||||
|
SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)"
|
||||||
|
|
||||||
|
if [ "x$SEMVER" = "x" ]
|
||||||
|
then
|
||||||
|
log "cannot figure out the semantic version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build to pick up the new version.
|
||||||
|
log "building project $SEMVER"
|
||||||
|
dotnet build || exit 1
|
||||||
|
|
||||||
|
# Create and publish the NuGet packages.
|
||||||
|
log "creating NuGet packages"
|
||||||
|
dotnet pack -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg || exit 1
|
||||||
|
|
||||||
|
log "publishing NuGet package"
|
||||||
|
dotnet nuget remove source mfgames.com >& /dev/null
|
||||||
|
dotnet nuget add source --name mfgames.com --username dmoonfire --password $GITEA_TOKEN https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json --store-password-in-clear-text || exit 1
|
||||||
|
dotnet nuget push --skip-duplicate --source mfgames.com src/*/bin/Debug/*.nupkg || exit 1
|
||||||
|
|
||||||
|
# Tag and push, but only if we don't have a tag.
|
||||||
|
if ! git tag | grep $SEMVER >& /dev/null
|
||||||
|
then
|
||||||
|
log "tagging and pushing"
|
||||||
|
git remote add publish https://dmoonfire:$GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url))
|
||||||
|
git tag $SEMVER
|
||||||
|
git push publish $SEMVER || exit 1
|
||||||
|
git remote remove publish
|
||||||
|
else
|
||||||
|
log "not tagging, already exists"
|
||||||
|
fi
|
31
scripts/setup.sh
Executable file
31
scripts/setup.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Set up logging.
|
||||||
|
log() { echo "📦️ $(basename $0): $@"; }
|
||||||
|
|
||||||
|
# Normalize our environment.
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
# Make sure we have the needed executables installed.
|
||||||
|
for e in dotnet lefthook prettier nixfmt
|
||||||
|
do
|
||||||
|
if ! which $e >& /dev/null
|
||||||
|
then
|
||||||
|
log "Cannot find '$e' in the path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Make sure we have lefthook is installed.
|
||||||
|
if [ ! -f .git/hooks/pre-commit ]
|
||||||
|
then
|
||||||
|
log "installing lefthook"
|
||||||
|
lefthook install
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure our tools are installed.
|
||||||
|
log "install .NET tools"
|
||||||
|
dotnet tool restore
|
||||||
|
|
||||||
|
# Everything is good.
|
||||||
|
exit 0
|
12
scripts/test.sh
Executable file
12
scripts/test.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Set up logging.
|
||||||
|
log() { echo "️🧪 $(basename $0): $@"; }
|
||||||
|
|
||||||
|
# Move into the root folder and make sure we're set up.
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"
|
||||||
|
dotnet tool run reportgenerator -reports:tests/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
||||||
|
grep "Line coverage" coverage/Summary.txt
|
4
scripts/update-template.sh
Executable file
4
scripts/update-template.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
git pull template main --no-rebase
|
|
@ -1,26 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
|
||||||
<RootNamespace>MfGames.Markdown.Gemini.Tests</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"/>
|
|
||||||
<PackageReference Include="JunitXml.TestLogger" Version="2.1.81" />
|
|
||||||
<PackageReference Include="xunit" Version="2.4.1"/>
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="coverlet.collector" Version="3.0.3">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MfGames.Markdown.Gemtext\MfGames.Markdown.Gemtext.csproj"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
|
@ -59,7 +59,9 @@ namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
gemtext.ObjectRenderers.Add(
|
gemtext.ObjectRenderers.Add(
|
||||||
new TableRenderer(this.Options.ConfigureTableBuilder));
|
new TableRenderer(
|
||||||
|
this.Options.OmitPreformatLines,
|
||||||
|
this.Options.ConfigureTableBuilder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,11 @@ namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
/// Gets or sets the table builder to control formatting.
|
/// Gets or sets the table builder to control formatting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<ConsoleTableBuilder>? ConfigureTableBuilder { get; set; }
|
public Action<ConsoleTableBuilder>? ConfigureTableBuilder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value whether the preformat (backticks) fence should
|
||||||
|
/// not be emitted.
|
||||||
|
/// </summary>
|
||||||
|
public bool OmitPreformatLines { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ using Markdig;
|
||||||
using Markdig.Extensions.SmartyPants;
|
using Markdig.Extensions.SmartyPants;
|
||||||
using Markdig.Parsers.Inlines;
|
using Markdig.Parsers.Inlines;
|
||||||
using Markdig.Renderers;
|
using Markdig.Renderers;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gemtextRenderer.ObjectRenderers
|
if (!gemtextRenderer.ObjectRenderers
|
||||||
.Contains<GemtextSmartyPantRenderer>())
|
.Contains<GemtextSmartyPantRenderer>())
|
||||||
{
|
{
|
||||||
gemtextRenderer.ObjectRenderers.Add(
|
gemtextRenderer.ObjectRenderers.Add(
|
||||||
new GemtextSmartyPantRenderer(this.Options));
|
new GemtextSmartyPantRenderer(this.Options));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Markdig.Renderers;
|
using Markdig.Renderers;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Extensions
|
namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Markdig.Renderers;
|
using Markdig.Renderers;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks;
|
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks;
|
||||||
|
|
||||||
|
@ -26,7 +27,8 @@ namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var heading = gemtext.ObjectRenderers.Find<HeadingRenderer>();
|
HeadingRenderer? heading =
|
||||||
|
gemtext.ObjectRenderers.Find<HeadingRenderer>();
|
||||||
|
|
||||||
if (heading != null)
|
if (heading != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Markdig.Renderers;
|
using Markdig.Renderers;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Extensions
|
namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Markdig.Renderers;
|
using Markdig.Renderers;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Extensions
|
namespace MfGames.Markdown.Gemtext.Extensions
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Markdig.Parsers;
|
using Markdig.Parsers;
|
||||||
using Markdig.Syntax;
|
using Markdig.Syntax;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext
|
namespace MfGames.Markdown.Gemtext
|
||||||
|
|
|
@ -1,25 +1,24 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>Dylan Moonfire</Authors>
|
<Authors>Dylan Moonfire</Authors>
|
||||||
<Company>Moonfire Games</Company>
|
<Company>Moonfire Games</Company>
|
||||||
<RepositoryUrl>https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil</RepositoryUrl>
|
<RepositoryUrl>https://gitlab.com/mfgames-cil/mfgames-markdown-cil</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<PackageTags>ecs</PackageTags>
|
<PackageProjectUrl>https://gitlab.com/mfgames-cil/mfgames-markdown-cil</PackageProjectUrl>
|
||||||
<PackageProjectUrl>https://gitlab.com/mfgames-cil/mfgames-markdown-gemtext-cil</PackageProjectUrl>
|
<PackageLicense>MIT</PackageLicense>
|
||||||
<PackageLicense>MIT</PackageLicense>
|
<Description>A MarkDig extension to render Markdown in Gemtext.</Description>
|
||||||
<Description>A Markdown extension to render Markdown in Gemtext.</Description>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ConsoleTableExt" Version="3.1.9" />
|
<PackageReference Include="ConsoleTableExt" Version="3.2.0"/>
|
||||||
<PackageReference Include="Markdig" Version="0.25.0" />
|
<PackageReference Include="Markdig" Version="0.30.3"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
||||||
renderer.EnsureTwoLines();
|
renderer.EnsureTwoLines();
|
||||||
|
|
||||||
// Go through each list item and write them out.
|
// Go through each list item and write them out.
|
||||||
foreach (var item in listBlock)
|
foreach (Block? item in listBlock)
|
||||||
{
|
{
|
||||||
// If the list only contains a link, then we just render the
|
// If the list only contains a link, then we just render the
|
||||||
// link instead.
|
// link instead.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Markdig.Syntax;
|
using Markdig.Syntax;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Markdig.Syntax;
|
using Markdig.Syntax;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
||||||
|
|
|
@ -13,16 +13,18 @@ namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
||||||
{
|
{
|
||||||
private readonly Action<ConsoleTableBuilder>? configureTableBuilder;
|
private readonly Action<ConsoleTableBuilder>? configureTableBuilder;
|
||||||
|
|
||||||
public TableRenderer(Action<ConsoleTableBuilder>? configureTableBuilder)
|
private readonly bool omitPreformat;
|
||||||
|
|
||||||
|
public TableRenderer(
|
||||||
|
bool omitPreformat,
|
||||||
|
Action<ConsoleTableBuilder>? configureTableBuilder)
|
||||||
{
|
{
|
||||||
|
this.omitPreformat = omitPreformat;
|
||||||
this.configureTableBuilder = configureTableBuilder;
|
this.configureTableBuilder = configureTableBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Write(GemtextRenderer renderer, Table table)
|
protected override void Write(GemtextRenderer renderer, Table table)
|
||||||
{
|
{
|
||||||
// Make sure we have plenty of space above us.
|
|
||||||
renderer.EnsureTwoLines();
|
|
||||||
|
|
||||||
// Since Gemtext doesn't have a table format per-se, we are going
|
// Since Gemtext doesn't have a table format per-se, we are going
|
||||||
// to use ConsoleTableEx to make a nicely-formatted table and emit
|
// to use ConsoleTableEx to make a nicely-formatted table and emit
|
||||||
// the lines directly. That should produce the desired result.
|
// the lines directly. That should produce the desired result.
|
||||||
|
@ -62,7 +64,21 @@ namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks
|
||||||
// Format the final table.
|
// Format the final table.
|
||||||
string formatted = builder.Export().ToString().TrimEnd();
|
string formatted = builder.Export().ToString().TrimEnd();
|
||||||
|
|
||||||
|
// Write out the table including making sure two lines are above it.
|
||||||
|
renderer.EnsureTwoLines();
|
||||||
|
|
||||||
|
if (!this.omitPreformat)
|
||||||
|
{
|
||||||
|
renderer.WriteLine("```");
|
||||||
|
}
|
||||||
|
|
||||||
renderer.WriteLine(formatted);
|
renderer.WriteLine(formatted);
|
||||||
|
|
||||||
|
if (!this.omitPreformat)
|
||||||
|
{
|
||||||
|
renderer.WriteLine("```");
|
||||||
|
renderer.WriteLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<object> GetCellValues(TableRow row)
|
private static List<object> GetCellValues(TableRow row)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
using Markdig.Extensions.SmartyPants;
|
using Markdig.Extensions.SmartyPants;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines
|
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Markdig.Syntax.Inlines;
|
using Markdig.Syntax.Inlines;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines
|
namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines
|
||||||
|
@ -25,7 +26,7 @@ namespace MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines
|
||||||
// write out each link which is already formatted.
|
// write out each link which is already formatted.
|
||||||
renderer.WriteLine();
|
renderer.WriteLine();
|
||||||
|
|
||||||
foreach (var link in renderer.GatheredLinks)
|
foreach (string? link in renderer.GatheredLinks)
|
||||||
{
|
{
|
||||||
renderer.WriteLine();
|
renderer.WriteLine();
|
||||||
renderer.Write(link);
|
renderer.Write(link);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using Markdig.Syntax;
|
using Markdig.Syntax;
|
||||||
using Markdig.Syntax.Inlines;
|
using Markdig.Syntax.Inlines;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Markdig.Helpers;
|
using Markdig.Helpers;
|
||||||
using Markdig.Renderers;
|
using Markdig.Renderers;
|
||||||
using Markdig.Syntax;
|
using Markdig.Syntax;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks;
|
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Blocks;
|
||||||
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
using MfGames.Markdown.Gemtext.Renderers.Gemtext.Inlines;
|
||||||
|
|
||||||
|
|
11
src/MfGames.Markdown/Extensions/WikiLink.cs
Normal file
11
src/MfGames.Markdown/Extensions/WikiLink.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using Markdig.Syntax.Inlines;
|
||||||
|
|
||||||
|
namespace MfGames.Markdown.Extensions;
|
||||||
|
|
||||||
|
public class WikiLink : LinkInline
|
||||||
|
{
|
||||||
|
public WikiLink()
|
||||||
|
{
|
||||||
|
this.IsClosed = false;
|
||||||
|
}
|
||||||
|
}
|
47
src/MfGames.Markdown/Extensions/WikiLinkExtension.cs
Normal file
47
src/MfGames.Markdown/Extensions/WikiLinkExtension.cs
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
using Markdig;
|
||||||
|
using Markdig.Parsers.Inlines;
|
||||||
|
using Markdig.Renderers;
|
||||||
|
|
||||||
|
namespace MfGames.Markdown.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translate `[[Bob]]` into `/bob/`.
|
||||||
|
/// </summary>
|
||||||
|
public class WikiLinkExtension : IMarkdownExtension
|
||||||
|
{
|
||||||
|
public WikiLinkExtension()
|
||||||
|
: this(null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public WikiLinkExtension(WikiLinkOptions? options)
|
||||||
|
{
|
||||||
|
this.Options = options ?? new WikiLinkOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public WikiLinkOptions Options { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Setup(MarkdownPipelineBuilder pipeline)
|
||||||
|
{
|
||||||
|
WikiLinkInlineParser? parser = pipeline.InlineParsers
|
||||||
|
.FindExact<WikiLinkInlineParser>();
|
||||||
|
|
||||||
|
if (parser != null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
parser = new WikiLinkInlineParser(this.Options);
|
||||||
|
pipeline.InlineParsers.InsertBefore<LinkInlineParser>(parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Setup(
|
||||||
|
MarkdownPipeline pipeline,
|
||||||
|
IMarkdownRenderer renderer)
|
||||||
|
{
|
||||||
|
// No setup needed here because we're using LinkInline which does the
|
||||||
|
// bulk of the work.
|
||||||
|
}
|
||||||
|
}
|
112
src/MfGames.Markdown/Extensions/WikiLinkInlineParser.cs
Normal file
112
src/MfGames.Markdown/Extensions/WikiLinkInlineParser.cs
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using Markdig.Helpers;
|
||||||
|
using Markdig.Parsers;
|
||||||
|
using Markdig.Syntax.Inlines;
|
||||||
|
|
||||||
|
namespace MfGames.Markdown.Extensions;
|
||||||
|
|
||||||
|
public class WikiLinkInlineParser : InlineParser
|
||||||
|
{
|
||||||
|
private readonly WikiLinkOptions options;
|
||||||
|
|
||||||
|
public WikiLinkInlineParser(WikiLinkOptions options)
|
||||||
|
{
|
||||||
|
this.options = options;
|
||||||
|
this.OpeningCharacters = new[] { '[' };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Match(
|
||||||
|
InlineProcessor processor,
|
||||||
|
ref StringSlice slice)
|
||||||
|
{
|
||||||
|
// We are looking for the `[[` opening for the tag and that the first
|
||||||
|
// one isn't escaped.
|
||||||
|
if (IsNotDelimiter(slice, '['))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to loop over the entire link, including the `[[` and `]]`
|
||||||
|
// while keeping track since we'll swallow additional characters beyond
|
||||||
|
// the link.
|
||||||
|
int linkStart = slice.Start;
|
||||||
|
int linkEnd = slice.Start;
|
||||||
|
|
||||||
|
slice.Start += 2;
|
||||||
|
|
||||||
|
// Our content starts after the double '[['.
|
||||||
|
int contentStart = slice.Start;
|
||||||
|
|
||||||
|
// We need to find the end of the link (the `]]`).
|
||||||
|
while (IsNotDelimiter(slice, ']'))
|
||||||
|
{
|
||||||
|
slice.NextChar();
|
||||||
|
linkEnd = slice.Start;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull out the components before we adjust for the ']]' for the end.
|
||||||
|
int contentEnd = linkEnd;
|
||||||
|
|
||||||
|
// Finish skipping over the `]]`.
|
||||||
|
slice.NextChar();
|
||||||
|
slice.NextChar();
|
||||||
|
|
||||||
|
// Format the label and the URL.
|
||||||
|
string content = slice.Text.Substring(
|
||||||
|
contentStart,
|
||||||
|
contentEnd - contentStart);
|
||||||
|
string[] contentParts = content.Split('|', 2);
|
||||||
|
string label = contentParts.Last();
|
||||||
|
string url = this.options.GetUrl(contentParts.First());
|
||||||
|
|
||||||
|
// Add in any trailing components. This merges the `'s` from
|
||||||
|
// `[[Dale]]'s` into the label.
|
||||||
|
while (this.options.IsTrailingLink(slice.CurrentChar))
|
||||||
|
{
|
||||||
|
label += slice.CurrentChar;
|
||||||
|
slice.NextChar();
|
||||||
|
linkEnd++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the link that we're replacing.
|
||||||
|
WikiLink link = new()
|
||||||
|
{
|
||||||
|
Span =
|
||||||
|
{
|
||||||
|
Start = processor.GetSourcePosition(
|
||||||
|
linkStart,
|
||||||
|
out int line,
|
||||||
|
out int column),
|
||||||
|
},
|
||||||
|
Line = line,
|
||||||
|
Column = column,
|
||||||
|
Url = url,
|
||||||
|
IsClosed = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
link.AppendChild(
|
||||||
|
new LiteralInline()
|
||||||
|
{
|
||||||
|
Line = line,
|
||||||
|
Column = column,
|
||||||
|
Content = new StringSlice(label),
|
||||||
|
IsClosed = true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace the inline and then indicate we have a match.
|
||||||
|
processor.Inline = link;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsNotDelimiter(
|
||||||
|
StringSlice slice,
|
||||||
|
char delimiter)
|
||||||
|
{
|
||||||
|
return slice.CurrentChar != delimiter
|
||||||
|
|| slice.PeekChar() != delimiter
|
||||||
|
|| slice.PeekCharExtra(-1) == '\\';
|
||||||
|
}
|
||||||
|
}
|
31
src/MfGames.Markdown/Extensions/WikiLinkOptions.cs
Normal file
31
src/MfGames.Markdown/Extensions/WikiLinkOptions.cs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using Markdig.Helpers;
|
||||||
|
|
||||||
|
namespace MfGames.Markdown.Extensions;
|
||||||
|
|
||||||
|
public class WikiLinkOptions
|
||||||
|
{
|
||||||
|
public WikiLinkOptions()
|
||||||
|
{
|
||||||
|
this.GetUrl = a => a;
|
||||||
|
this.IsTrailingLink = a => a.IsAlpha() || a == '\'';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The callback to determine the link from the given wiki link. This does
|
||||||
|
/// not include trailing additions or use the label (e.g., `(ab|cd)` would
|
||||||
|
/// get `ab` as the parameters of this function.
|
||||||
|
/// </summary>
|
||||||
|
public Func<string, string> GetUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// A callback to determine if the text after the link should be merged
|
||||||
|
/// with the link label. This allows links such as [[Dale]]'s to be turned
|
||||||
|
/// into "Dale's" but pointing to "Dale" as a page.
|
||||||
|
/// </para>
|
||||||
|
/// <para>The default is to include any character or the apostrophe.</para>
|
||||||
|
/// </summary>
|
||||||
|
public Func<char, bool> IsTrailingLink { get; set; }
|
||||||
|
}
|
23
src/MfGames.Markdown/MfGames.Markdown.csproj
Normal file
23
src/MfGames.Markdown/MfGames.Markdown.csproj
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
|
<Authors>Dylan Moonfire</Authors>
|
||||||
|
<Company>Moonfire Games</Company>
|
||||||
|
<RepositoryUrl>https://gitlab.com/mfgames-cil/mfgames-markdown-cil</RepositoryUrl>
|
||||||
|
<RepositoryType>Git</RepositoryType>
|
||||||
|
<PackageProjectUrl>https://gitlab.com/mfgames-cil/mfgames-markdown-cil</PackageProjectUrl>
|
||||||
|
<PackageLicense>MIT</PackageLicense>
|
||||||
|
<Description>Various extensions for MarkDig and classes for working with Markdown.</Description>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Markdig" Version="0.30.3"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
1
src/README.md
Normal file
1
src/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Source Directories
|
|
@ -1,10 +1,11 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class CodeInlineTests
|
public class CodeInlineTests
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class HeaderTests
|
public class HeaderTests
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class ImageLinkTests
|
public class ImageLinkTests
|
||||||
{
|
{
|
|
@ -1,9 +1,10 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class IncreaseHeaderDepthsAfterFirstTests
|
public class IncreaseHeaderDepthsAfterFirstTests
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class LinkTests
|
public class LinkTests
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class ListTests
|
public class ListTests
|
||||||
{
|
{
|
|
@ -0,0 +1,27 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MfGames.TestSetup" Version="1.0.6"/>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1"/>
|
||||||
|
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114"/>
|
||||||
|
<PackageReference Include="xunit" Version="2.4.2"/>
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\MfGames.Markdown.Gemtext\MfGames.Markdown.Gemtext.csproj"/>
|
||||||
|
<ProjectReference Include="..\..\src\MfGames.Markdown\MfGames.Markdown.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -1,10 +1,11 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the various functionality of the ParagraphLinkHandling and
|
/// Tests the various functionality of the ParagraphLinkHandling and
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class PlainTextTests
|
public class PlainTextTests
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests.PythonInspired
|
namespace MfGames.Markdown.Gemtext.Tests.PythonInspired
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_base_url.py
|
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_base_url.py
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests.PythonInspired
|
namespace MfGames.Markdown.Gemtext.Tests.PythonInspired
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_codeblock.py
|
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_codeblock.py
|
|
@ -1,7 +1,6 @@
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests.PythonInspired
|
namespace MfGames.Markdown.Gemtext.Tests.PythonInspired
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_list.py
|
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_list.py
|
|
@ -1,9 +1,10 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests.PythonInspired
|
namespace MfGames.Markdown.Gemtext.Tests.PythonInspired
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs through various plain input tests.
|
/// Runs through various plain input tests.
|
|
@ -1,12 +1,11 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
using MfGames.Markdown.Gemtext.Renderers;
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests.PythonInspired
|
namespace MfGames.Markdown.Gemtext.Tests.PythonInspired
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_strip_html.py
|
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_strip_html.py
|
|
@ -1,10 +1,11 @@
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Markdig.Extensions.SmartyPants;
|
using Markdig.Extensions.SmartyPants;
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class QuoteTests
|
public class QuoteTests
|
||||||
{
|
{
|
|
@ -2,12 +2,11 @@ using ConsoleTableExt;
|
||||||
|
|
||||||
using Markdig;
|
using Markdig;
|
||||||
|
|
||||||
using MfGames.Markdown.Gemtext;
|
|
||||||
using MfGames.Markdown.Gemtext.Extensions;
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace MfGames.Markdown.Gemini.Tests
|
namespace MfGames.Markdown.Gemtext.Tests
|
||||||
{
|
{
|
||||||
public class TableTests
|
public class TableTests
|
||||||
{
|
{
|
||||||
|
@ -19,6 +18,7 @@ namespace MfGames.Markdown.Gemini.Tests
|
||||||
new GemtextPipeTableExtension(
|
new GemtextPipeTableExtension(
|
||||||
new GemtextPipeTableOptions()
|
new GemtextPipeTableOptions()
|
||||||
{
|
{
|
||||||
|
OmitPreformatLines = true,
|
||||||
ConfigureTableBuilder = (x) =>
|
ConfigureTableBuilder = (x) =>
|
||||||
x.WithFormat(
|
x.WithFormat(
|
||||||
ConsoleTableBuilderFormat.MarkDown),
|
ConsoleTableBuilderFormat.MarkDown),
|
||||||
|
@ -42,6 +42,40 @@ namespace MfGames.Markdown.Gemini.Tests
|
||||||
Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FencedTable()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = new MarkdownPipelineBuilder()
|
||||||
|
.Use(
|
||||||
|
new GemtextPipeTableExtension(
|
||||||
|
new GemtextPipeTableOptions()
|
||||||
|
{
|
||||||
|
ConfigureTableBuilder = (x) =>
|
||||||
|
x.WithFormat(
|
||||||
|
ConsoleTableBuilderFormat.MarkDown),
|
||||||
|
}))
|
||||||
|
.Build();
|
||||||
|
string input = string.Join(
|
||||||
|
"\n",
|
||||||
|
"aaa|bbb|ccc",
|
||||||
|
"--:|---|:-:",
|
||||||
|
"1|2|3",
|
||||||
|
"4|5|6");
|
||||||
|
string expected = string.Join(
|
||||||
|
"\n",
|
||||||
|
"```",
|
||||||
|
"| aaa | bbb | ccc |",
|
||||||
|
"|-----|-----|-----|",
|
||||||
|
"| 1 | 2 | 3 |",
|
||||||
|
"| 4 | 5 | 6 |",
|
||||||
|
"```",
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
string actual = MarkdownGemtext.ToGemtext(input, pipeline);
|
||||||
|
|
||||||
|
Assert.Equal(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SimpleTable()
|
public void SimpleTable()
|
||||||
{
|
{
|
||||||
|
@ -50,6 +84,7 @@ namespace MfGames.Markdown.Gemini.Tests
|
||||||
new GemtextPipeTableExtension(
|
new GemtextPipeTableExtension(
|
||||||
new GemtextPipeTableOptions()
|
new GemtextPipeTableOptions()
|
||||||
{
|
{
|
||||||
|
OmitPreformatLines = true,
|
||||||
ConfigureTableBuilder = (x) =>
|
ConfigureTableBuilder = (x) =>
|
||||||
x.WithFormat(
|
x.WithFormat(
|
||||||
ConsoleTableBuilderFormat.MarkDown),
|
ConsoleTableBuilderFormat.MarkDown),
|
56
tests/MfGames.Markdown.Gemtext.Tests/WikiLinkTests.cs
Normal file
56
tests/MfGames.Markdown.Gemtext.Tests/WikiLinkTests.cs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
using Markdig;
|
||||||
|
|
||||||
|
using MfGames.Markdown.Extensions;
|
||||||
|
using MfGames.Markdown.Gemtext.Extensions;
|
||||||
|
using MfGames.Markdown.Gemtext.Renderers;
|
||||||
|
using MfGames.TestSetup;
|
||||||
|
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace MfGames.Markdown.Gemtext.Tests;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests the functionality of the WriteFiles().
|
||||||
|
/// </summary>
|
||||||
|
public class WikiLinkTest : TestBase<TestContext>
|
||||||
|
{
|
||||||
|
public WikiLinkTest(ITestOutputHelper output)
|
||||||
|
: base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PossessiveLabeledWikiLinkGemtext()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = MarkdownGemtext
|
||||||
|
.ToGemtext(
|
||||||
|
"[[Test|Label]]'s",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("=> ^test$ Label's", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MarkdownPipeline CreatePipeline()
|
||||||
|
{
|
||||||
|
// Convert all titles to slugs.
|
||||||
|
WikiLinkOptions options = new()
|
||||||
|
{
|
||||||
|
GetUrl = (title) => string.Format(
|
||||||
|
"^{0}$",
|
||||||
|
title.ToLowerInvariant().Replace(" ", "-")),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create the pipeline and return the results.
|
||||||
|
MarkdownPipelineBuilder builder = new MarkdownPipelineBuilder()
|
||||||
|
.Use(new WikiLinkExtension(options))
|
||||||
|
.Use(new SetBlockLinkHandling(BlockLinkHandling.DocumentEnd));
|
||||||
|
|
||||||
|
// Build the pipeline and return it.
|
||||||
|
MarkdownPipeline pipeline = builder.Build();
|
||||||
|
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
}
|
28
tests/MfGames.Markdown.Tests/MfGames.Markdown.Tests.csproj
Normal file
28
tests/MfGames.Markdown.Tests/MfGames.Markdown.Tests.csproj
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Markdig" Version="0.30.3"/>
|
||||||
|
<PackageReference Include="MfGames.TestSetup" Version="1.0.6"/>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1"/>
|
||||||
|
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114"/>
|
||||||
|
<PackageReference Include="xunit" Version="2.4.2"/>
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\MfGames.Markdown\MfGames.Markdown.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
188
tests/MfGames.Markdown.Tests/WikiLinkTests.cs
Normal file
188
tests/MfGames.Markdown.Tests/WikiLinkTests.cs
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
using Markdig;
|
||||||
|
|
||||||
|
using MfGames.Markdown.Extensions;
|
||||||
|
using MfGames.TestSetup;
|
||||||
|
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace MfGames.Markdown.Tests;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests the functionality of the WriteFiles().
|
||||||
|
/// </summary>
|
||||||
|
public class WikiLinkTest : TestBase<TestContext>
|
||||||
|
{
|
||||||
|
public WikiLinkTest(ITestOutputHelper output)
|
||||||
|
: base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void BareStringHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown.ToHtml(
|
||||||
|
"This is text.",
|
||||||
|
pipeline);
|
||||||
|
|
||||||
|
Assert.Equal("<p>This is text.</p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void BlankStringHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown.ToHtml(
|
||||||
|
"",
|
||||||
|
pipeline);
|
||||||
|
|
||||||
|
Assert.Equal("", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void LabeledWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test|Label]]",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Label</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PossessiveLabeledWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test|Label]]'s",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Label's</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PossessiveWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test]]'s",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Test's</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PunctuationLabeledWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test|Label]].",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Label</a>.</p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PunctuationWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test]].",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Test</a>.</p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SentenceWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"This is a [[test]] of this system.",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal(
|
||||||
|
"<p>This is a <a href=\"^test$\">test</a> of this system.</p>\n",
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SimpleWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test]]",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Test</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void StandardLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown.ToHtml(
|
||||||
|
"[Test](https://test/)",
|
||||||
|
pipeline);
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"https://test/\">Test</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TrailingLabeledWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test|Label]]s",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Labels</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TrailingWikiLinkHtml()
|
||||||
|
{
|
||||||
|
MarkdownPipeline pipeline = CreatePipeline();
|
||||||
|
string result = Markdig.Markdown
|
||||||
|
.ToHtml(
|
||||||
|
"[[Test]]s",
|
||||||
|
pipeline)
|
||||||
|
.Replace("%5E", "^");
|
||||||
|
|
||||||
|
Assert.Equal("<p><a href=\"^test$\">Tests</a></p>\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MarkdownPipeline CreatePipeline()
|
||||||
|
{
|
||||||
|
WikiLinkOptions options = new()
|
||||||
|
{
|
||||||
|
GetUrl = (title) => string.Format(
|
||||||
|
"^{0}$",
|
||||||
|
title.ToLowerInvariant().Replace(" ", "-")),
|
||||||
|
};
|
||||||
|
|
||||||
|
MarkdownPipelineBuilder? builder = new MarkdownPipelineBuilder()
|
||||||
|
.Use(new WikiLinkExtension(options));
|
||||||
|
MarkdownPipeline? pipeline = builder.Build();
|
||||||
|
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
}
|
1
tests/README.md
Normal file
1
tests/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Test Projects
|
Reference in a new issue