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

Extra HTML to Markdown Work to fix bugs #26

Merged
merged 17 commits into from
May 9, 2023

Conversation

mellenberger
Copy link
Contributor

For the issue of escaping the '<>' symbols for the HTML to render correctly, we have come up with two separate possible solutions.

  1. The first solution is on the client side, in the CodeChatEditor.mts file. A new rule was added to the turndown service to attempt to escape only the necessary symbols. This solution leaves the escaped versions of the symbols in the source code & also escapes the '<>' symbols within code sections. The escaped HTML does not render correctly within code sections, so this solution is not fully working as of now.

  2. The second finished solution is on the server side, in the webserver.rs file. A regex was used to escape some of the '<>' symbols during the markdown-to-HTML process. All of the '<>' symbols not within code sections (between backticks for markdown) are escaped so they are not read as HTML tags. The '<>' symbols within code sections are not escaped due to them not rendering correctly if escaped.

Other minor fixes from the previous PR:

  • For HTML-to-markdown conversion, the anchor tag is now kept as HTML.
  • The smart punctuation option has been turned off within the markdown-to-html pulldown-cmark parser. This should stop future conversions to smart punctuation within the source code.

@mellenberger
Copy link
Contributor Author

Also, not sure what happened with the commits for this PR, but the only new ones are the last four. The changed files look to be correct though and show only the changes from the last four commits.

@bjones1
Copy link
Owner

bjones1 commented May 4, 2023

Thanks for working on this! I'll take a look, but probably not until next week.

@bjones1 bjones1 merged commit b253277 into bjones1:html-to-markdown May 9, 2023
@bjones1
Copy link
Owner

bjones1 commented Jun 2, 2023

I'm continuing to work on this, looking to integrate it into the main branch. Thoughts/comments:

Another approach: abandon this and use Pandoc instead. Pro: well-maintained and active project. Cons: requires users to install Pandoc; requires work to interface with the Pandoc server.

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