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

Refactor html2markdown and markdown2html to classes and upgrade turndown #16372

Merged
merged 10 commits into from
Jun 3, 2024

Conversation

filipsobol
Copy link
Member

@filipsobol filipsobol commented May 17, 2024

Suggested merge commit message (convention)

Other (markdown-gfm): Refactor html2markdown and markdown2html to classes to improve tree-shaking. Related to #16292.

Other (markdown-gfm): Upgrade turndown to version 7.2.0. Closes #16371.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

@Reinmar
Copy link
Member

Reinmar commented May 20, 2024

Misses the "Closes" annotations. AFAIK, it closes two tickets, right?

@Witoso
Copy link
Member

Witoso commented May 20, 2024

We didn't plan to bump the lib, AFAIK, the plan was to better tree shake it.

@filipsobol filipsobol changed the title Other: Refactor html2markdown and markdown2html to classes. Refactor html2markdown and markdown2html to classes and upgrade turndown May 20, 2024
@@ -273,7 +273,7 @@ describe( 'GFMDataProcessor', () => {
'<p><code>code `` code ```</code></p>',

// When converting back ````` will be normalized to ``.
'`code `` code ``` `'
'` code `` code ``` `'
Copy link
Member Author

Choose a reason for hiding this comment

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

I tested few html-to-markdown converts available online and they are not consistent. I got the following results when converting <p><code>code `` code ```</code></p> to markdown:

` code `` code ``` ` (new result)
`code `` code ``` ` (old result)
`code `` code ````

The first two results can be converted back to identical HTML, while the last one is incorrect:

<p><code>code `` code ``` </code></p> (new result)
<p><code>code `` code ``` </code></p> (old result)
<p>`code `` code ````</p>

Because the "before" and "after" results are identical, I think this change is okay.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested few html-to-markdown converts available online and they are not consistent.

The GFMD stands for "GitHub Flavored Markdown" so we should be aligned with it.

packages/ckeditor5-markdown-gfm/src/gfmdataprocessor.ts Outdated Show resolved Hide resolved
packages/ckeditor5-markdown-gfm/src/gfmdataprocessor.ts Outdated Show resolved Hide resolved
packages/ckeditor5-markdown-gfm/src/gfmdataprocessor.ts Outdated Show resolved Hide resolved
@@ -273,7 +273,7 @@ describe( 'GFMDataProcessor', () => {
'<p><code>code `` code ```</code></p>',

// When converting back ````` will be normalized to ``.
'`code `` code ``` `'
'` code `` code ``` `'
Copy link
Contributor

Choose a reason for hiding this comment

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

I tested few html-to-markdown converts available online and they are not consistent.

The GFMD stands for "GitHub Flavored Markdown" so we should be aligned with it.

Co-authored-by: Kuba Niegowski <1232187+niegowski@users.noreply.github.com>
@filipsobol filipsobol merged commit 990afc7 into master Jun 3, 2024
7 checks passed
@filipsobol filipsobol deleted the turn-markdown-and-html-processorors-to-classes branch June 3, 2024 15:09
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.

Deprecated depedencies: ckeditor5-markdown-gfm -> [abab@2.0.6, domexception@2.0.1, w3c-hr-time@1.0.2]
5 participants