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

🐛 Fix TOC visible text and GitHub slug generation #890

Merged
merged 3 commits into from
Feb 1, 2021
Merged

Conversation

Lemmingh
Copy link
Collaborator

@Lemmingh Lemmingh commented Feb 1, 2021

Summary

  • Fix Exporting produces invalid HTML for fenced code blocks #662: The <div> tags are a quirk of vscode.markdown-language-features, which uses them for source mapping. But we don't need.
  • Fix Incorrect TOC for reference link #515: This time, work on parsing result to simulate GitHub's rendering pipelines. We will no longer have any problem in generating slugs for it, unless markdown-it has bug.
  • Fix TOC visible text generation. (Links to headings with emoji code may be broken #792 (comment) case 2)
  • Fix slug generation for exporting in MarkdownEngine class.
  • Introduce IDisposable, then we can create and register our own disposables in future.
  • Normalize the interface of Markdown engines.
  • Add getDocumentToken() to Markdown engines.
  • Roll ECMAScript private fields back to TypeScript private properties. It occurred to me that five years ago, TS's transpiling for async functions caused a few surprising results. Since private field is still a stage 3 proposal, we'd better not adopt it now, for stability.
  • Update webpack to 5.19.0 by the way.

Verification

Note:
Our heading recognition in TOC does not support multiline heading, so, you need to "Print to HTML" to inspect the last heading.
Be careful about those trailing spaces.

# `</title><script>alert('woo');</script><title>`

```c
#include <stdio>
//
```

```
<em>text</em>
```

##  ``b``[a]_c_[]\\[ [k](h) **g**![`m`](i) <https://r.u/> <small>d</small>  <!--p-->

e
f  
s\
&Aring;&#8629; &#27700; \&lt; <r>  😂 </r>
---

[a]: v

@Lemmingh Lemmingh added Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Area: Exporting To HTML. Probably also other formats someday. labels Feb 1, 2021
@Lemmingh Lemmingh added this to the Next milestone Feb 1, 2021
@Lemmingh Lemmingh self-assigned this Feb 1, 2021
Copy link
Owner

@yzhang-gh yzhang-gh left a comment

Choose a reason for hiding this comment

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

LGTM 👍.

Any thoughts about the failed test?

@Lemmingh
Copy link
Collaborator Author

Lemmingh commented Feb 1, 2021

That function is dedicated to link text, thus, only escaping inline syntax is enough. # cannot become an evil here.

As for the timeout ... no idea.

@Lemmingh Lemmingh merged commit 51ed4fb into master Feb 1, 2021
@Lemmingh Lemmingh deleted the dev/engine branch February 1, 2021 06:01
@yzhang-gh yzhang-gh mentioned this pull request Jun 20, 2021
12 tasks
@Lemmingh Lemmingh added the Area: Link (Reserved) Markdown link processing, URI recognition, slugification. label Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Exporting To HTML. Probably also other formats someday. Area: Link (Reserved) Markdown link processing, URI recognition, slugification. Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations).
Projects
None yet
2 participants