-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add fix_string() to the API #1159
Comments
This sounds like a great idea, and we can make sure to work on it. Can you give me some bad examples of "pretty messy"? |
Here are two examples of html2text WordPress blog post conversions that sech have over 70 rule violations in the Visual Studio Code markdownlint extension. The editor makes it easy to clean everything up in a few clicks, but if you have a bunch of files, that gets tedious. I've observed that the following rules are the ones commonly violated:
For what it's worth, I've opened an issue with the html2text project to try and address it there too. |
This is my project, by the way |
Just committed changes for you to try out. Do you need an actual PyPy package release to test it? |
Unfortunately, I didn't keep the original markdown. Sorry. |
Sorry, perhaps we should have been clearer. You want to call PyMarkdown from within your Python application, correct? If so, the changes are in the main branch. I am assuming that you need an actual release that you can import from PyPi to use it, correct? |
Yes |
If I understand the object returned by the function correctly, I use it like this, right? from pymarkdown.api import PyMarkdownApi
pymd = PyMarkdownApi()
fix_result = pymd.fix_string(content_markdown)
if fix_result.was_fixed:
content_markdown = fix_result.fixed_file |
Just released version 0.9.24 which has updated API docs as well as this API. Please let us know if you have any issues with it. |
It is working as expected and is now included in wp2jekyll. Thanks! |
I saw that the CLI has a fix option, but that is not currently exposed in the API.
I'm creating a Python project that uses
html2text
to convert some HTML content to Markdown. The results are pretty messy. Themarkdownlint
extension for Visual Studio Code can clean up a lot of linting errors automatically. I'd like to do the same thing before writing the Markdown content to a file to save time and effort.The text was updated successfully, but these errors were encountered: