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
feat: support markdown #2943
feat: support markdown #2943
Conversation
That's a test snapshot file, the top part is unformatted, the bottom part is formatted. 😅 Looks like: export[xxx] = `
unformatted
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
formatted
`; |
O! well that explains it. That looks much prettier 💯 |
I have a question. It seem that current implementaion has two problems. First, current implementation will be broken in Chinese-Japanese-Korean(CJK) and emoji. For example, This issue is known as East Asian Width or Unicode problem. I know that East Asian Width problem is very difficult.( I don't know perfect solution...)
Second, Following tokenizer can not tokenize non-English text.
It will be resolved by using tokenizer like nlcst-parse-japanese, parse-english, and rakutenma. Toknizer example is Text Tokenizer · Hivemall User Manual Thanks. |
Thanks for the suggestion, I've already thought about it and just merged #3003 to fix the printer first, the CJK support is working in progress now, but it should be in a separate PR I think, this PR is somehow too large. I think there's no need to use tokenizer for CJK, since AFAIK they can be broke in any place, and that's how CJK books printed, e.g.
For the string width thing, use Do we have any concern to merge this PR? I'd like to send some followed up PRs instead of pushing to the current branch since this PR is somehow too large to review easily. |
I've been incrementally reviewing the changes so we're fine to merge! |
So cool! |
Amazing! Is it possible to also support Mardown dialects, such as Kramdown, used by Jekyll? |
It seems For new language support, see #3017 (comment). |
@ikatyang thanks, I'll see what I can do! |
Now we should format all |
@lipis Good idea! |
#3022 quite a few things to take care of though |
Big Data research part two: https://bigquery.cloud.google.com/savedquery/652929483875:69be015faec8444c8a2e7d055eeb32f8
|
There's also the
(current) - 123
- 123
+ 456
+ 456 <ul>
<li>123</li>
<li>123</li>
</ul>
<ul>
<li>456</li>
<li>456</li>
</ul> |
|
contents.push(rowContents); | ||
}, "children"); | ||
|
||
const columnMaxWidths = contents.reduce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also limit the max length of the columns. For example, All-Contributors tables contain HTML code and table dash columns processed by Prettier get very very long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you open a new issue so we can track this better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done #4195
Main:
remark-parse
with commonmark option enabled (GFM is based on commonmark)#
-style_
**
-
(always),+
(switch between two style for continuous lists)1.
(always),1)
(switch between two style for continuous lists)- - -
(always),* * *
(in list)```
(always),~~~
(in js template)|
and align table cell separator and respect alignmentfill
word by word (whitespace-based).Side:
align
'sn
to be string available. (use forquoteblock
)Question:
Should name this parserAns:markdown
(current) orremark
?markdown
NOTE:
/code
html
/yaml
still remains the same.does not supportbreak
(trailing two spaces).TODO:
<!-- prettier-ignore -->
code
escape html entities (html entities remain the same (<
,>
,&
)<
, etc.).<!-- prettier-ignore -->
not to print additional line break~~~
-style code block for markdown in template stringAST_COMPARE
(607/616
)Closes #2444