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

allow custom cmark options and extensions when converting Markdown #23

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

QuietMisdreavus
Copy link
Contributor

Bug/issue #, if applicable: n/a

Summary

Currently, swift-markdown uses a static set of options and extensions when converting Markdown source. However, there are several options and unused extensions in cmark-gfm that could be used. This PR adds a new ConvertOptions type to wrap the existing ParseOptions type with additional information that is passed to cmark-gfm when converting.

Dependencies

None

Testing

markdown-tool has been extended to allow custom extensions (and to allow disabling the default extensions). With the following Markdown file, run swift run markdown-tool dump-tree test.md. Compare the results with no flags, when adding --no-default-extensions, when adding --extension autolink, and with both.

There is ~~some stricken text~~ here, and a link to http://example.com.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

nighthawk added a commit to maparoni/down-gfm that referenced this pull request Mar 12, 2022
Changes:

- Removes embedded `cmark` in favour of [`apple/swift-cmark`](https://github.com/apple/swift-cmark)
- Removes AST code in favour of [`apple/swift-markdown`](https://github.com/apple/swift-markdown)
- Removes DebugVisitor in favour of `document.debugDescription()` from `swift-markdown`
- Support tasklist/checkbox

Later:

- Restore ordered list starts, depends on: swiftlang/swift-markdown#22
- Restore various Down options, depends on: swiftlang/swift-markdown#23
@QuietMisdreavus
Copy link
Contributor Author

Rebased onto the latest main to resolve a merge conflict.

@QuietMisdreavus
Copy link
Contributor Author

Rebased to resolve merge conflict.

@swift-ci Please test

CreatureSurvive added a commit to CreatureSurvive/swift-markdown that referenced this pull request Dec 31, 2023
CreatureSurvive added a commit to CreatureSurvive/swift-markdown that referenced this pull request Dec 31, 2023
@m-y-n-o-n-a
Copy link

When will this pr be merged?

@LiYanan2004
Copy link

LiYanan2004 commented Oct 17, 2024

Any updates for this PR?

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.

3 participants