Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic markdown support #84

Merged
merged 9 commits into from
Nov 16, 2022
Merged

feat: add basic markdown support #84

merged 9 commits into from
Nov 16, 2022

Conversation

camshaft
Copy link
Member

@camshaft camshaft commented Sep 22, 2022

Fixes #9

Description of changes:

This change adds support for citing markdown specifications. I've added a bunch of new tests to make sure nothing broke in the process.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@seebees
Copy link
Contributor

seebees commented Nov 8, 2022

Using https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-key-arn.md as an example Markdown.

On extract the -f MARKDOWN MUST be passed.
However, with the change added,
it can recognize the markdown.
But, that's fine :)

However, the requirements parsing is off by "1".

The above produces the following extracted TOML

target = "aws-encryption-sdk-specification/framework/aws-kms/aws-kms-key-arn.md#appendix-A valid AWS KMS ARN"

# A valid AWS KMS ARN
#
# 
# A string with 5 `:` that delimit following 6 parts:
# 
# 1. MUST start with string `arn`
# 2. The partition MUST be a non-empty
# 3. The service MUST be the string `kms`
# 4. The region MUST be a non-empty string
# 5. The account MUST be a non-empty string
# 6. The resource section MUST be non-empty and MUST be split by a single `/`
#    any additional `/` are included in the resource id
#    1. The resource type MUST be either `alias` or `key`
#    2. The resource id MUST be a non-empty string
# 

[[spec]]
level = "MUST"
quote = '''
MUST start with string `arn`
2.
'''

[[spec]]
level = "MUST"
quote = '''
The partition MUST be a non-empty
3.
'''

[[spec]]
level = "MUST"
quote = '''
The service MUST be the string `kms`
4.
'''

[[spec]]
level = "MUST"
quote = '''
The region MUST be a non-empty string
5.
'''

[[spec]]
level = "MUST"
quote = '''
The account MUST be a non-empty string
6.
'''

[[spec]]
level = "MUST"
quote = '''
The resource section MUST be non-empty and MUST be split by a single `/`
any additional `/` are included in the resource id
1.
'''

[[spec]]
level = "MUST"
quote = '''
The resource section MUST be non-empty and MUST be split by a single `/`
any additional `/` are included in the resource id
1.
'''

[[spec]]
level = "MUST"
quote = '''
The resource type MUST be either `alias` or `key`
2.
'''

[[spec]]
level = "MUST"
quote = '''
The resource id MUST be a non-empty string
'''

@camshaft
Copy link
Member Author

camshaft commented Nov 8, 2022

The parser is missing list handling so it's assuming the number is part of the sentence on the previous line.

@seebees
Copy link
Contributor

seebees commented Nov 12, 2022

There is some kind of corner case with Appendix in a title

/framework/caching-cmm/appendix-a-cache-entry-identifier-formulas.toml#0:0 - section "a-cache-entry-identifier-formulas" not found in "aws-encryption-sdk-specification/framework/caching-cmm.md"
source errors were found. no reports were generated

https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/caching-cmm.md#appendix-a-cache-entry-identifier-formulas

@seebees
Copy link
Contributor

seebees commented Nov 13, 2022

In the report, the whole line is not highlighted.

Copy link
Contributor

@seebees seebees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look good to me.
The ESDK specification parses now with Markdown.

@camshaft camshaft marked this pull request as ready for review November 16, 2022 05:08
@camshaft camshaft requested a review from a team as a code owner November 16, 2022 05:08
@camshaft camshaft merged commit f8ebf29 into main Nov 16, 2022
@camshaft camshaft deleted the camshaft/markdown branch November 16, 2022 05:08
@camshaft camshaft mentioned this pull request Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown support in extract
2 participants