-
Notifications
You must be signed in to change notification settings - Fork 114
Conversation
This is a good start! Eventually you'll want to add specs for this. (Also, 💄 is deprecated in favor of 🎨 for code structure / formatting changes, and this isn't really a code structure / formatting change – it's really a 🐛 ) |
Indeed, the art is much better than a lipstick. 😄 OK! Will make sure that the tests are passing and I will also try to add the specs for this. |
Really cool. I think that having the italic/bold marks with a different syntax style than the italic/bold content is useful. |
I fixed the bold and bold + italic styles as well: Is it possible to pass the regex flags in this format (would need to pass Also, I'm not sure where to start fixing the failing tests. 💚 |
I think you should capture the And the tests are in the |
That's already done, but not separately, but I was asking how can I apply bold style on the last two rows? I guess it's related to the I will try to fix the failing tests and then writing the new specs on this issue. |
Is it possible to log only the first failing test when running |
I don't know if that's possible (see jasmine/jasmine#414), but you can focus on a specific |
Yes, that's a good solution. Thanks! 👍 Also, is it possible to merge repetitive snippets like the following ones, into one? {
'match': '...',
'captures':
'2':
'name': 'markup.bold.italic.gfm'
'3':
'name': 'markup.bold.italic.gfm'
'4':
'name': 'markup.bold.italic.gfm'
} ...maybe something like this: {
'match': '...',
'captures':
'2':
'3':
'4':
'name': 'markup.bold.italic.gfm'
} I'm not very familiar with the cson format. |
I don't think that's possible. |
'begin': '(?<=^|[^\\w\\d_])__(?!$|_|\\s)' | ||
'end': '(?<!^|\\s)__*_(?=$|[^\\w|\\d])' | ||
'name': 'markup.bold.gfm' | ||
'match': '^___([\\s\\S]+?)___(?!_)|^\\*\\*\\*([\\s\\S]+?)\\*\\*\\*(?!\\*)' |
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.
I currently have 'match': '(?<=^|[^\\w\\d\\*])(\\*\\*\\*)([\\s\\S]+?)(\\*\\*\\*)(?=$|[^\\w|\\d])'
, and I the tokens are:
[
{
"value": "this is ",
"scopes": [
"source.gfm"
],
"bufferDelta": 8,
"hasPairedCharacter": false,
"screenDelta": 8
},
{
"value": "***bold italic***",
"scopes": [
"source.gfm",
"markup.bold.italic.gfm"
],
"bufferDelta": 17,
"hasPairedCharacter": false,
"screenDelta": 17
},
{
"value": " text",
"scopes": [
"source.gfm"
],
"bufferDelta": 5,
"hasPairedCharacter": false,
"screenDelta": 5
}
]
I expected that by doing (\\*\\*\\*)
these will be grouped in another element ({ value: "***" }
). The regex101 tester works fine in this direction:
How can I catch these characters into a separate group when using apm test
? Also, what tool is used for parsing this regex?
The main problem I found: mixed emphasis are handled badly, as well as some cases of escaped I created this test markdown, below you can see how github renders it. As you can see some github rendered stuff is not consistent.
EmphasisBold
|
Hey @leipert (and others), I've been looking into this as well (see #120, different thing, but got me thinking about Markdown), and I think multiline emphasis is just not part of the philosophy behind Markdown. From that same philosophy, I believe headings, for example, shouldn't be able to contain inline markup. Markdown is about simplicity. If you want complex markup, use HTML. I haven't looked at all your examples above, but how about we write specs for how we believe the simple version of Markup should be implemented, and ignore the weird edge cases? |
@burodepeper You are right, markdown is all about simplicity, but it is also really expressive. That it is the reason why you are able to compile it to nice looking HTML, PDF or even Powerpoint with tools like pandoc. Even the original MD definition by John Gruber is allowing you advanced stuff like inline HTML https://daringfireball.net/projects/markdown/syntax. The original spec does not forbid you to use something like this: # This is a *fancy* header This is the reason why most markdown renderers allow you to write inline emphasis. Furthermore the syntax highlighting should reflect the actual render. It makes no sense, that the language-gfm package shows you another syntax than the markdown-preview output. On a side note:
|
I don't agree on that. I believe Markdown is about nothing more than semantics (as html is supposed to be). Aren't you supposed to be able to semantically read a Markdown document without any syntax highlighting? I've started using Markdown in my emails, and people understand marking words with asterisks, and specifying headers and
That's something I do agree on! ; )
I've heard about it, but haven't really looked into it. Putting it on my list right now. In short, I use markdown files a lot, so I don't mind spending time to improve the language-gfm package. And since it's Github Flavored, who's in charge of deciding the level of simplicity? |
I also use markdown files a lot, which brought me to participate in these three packages:
Sorry for the advertisement, if you find any useful code in language-pfm, I am happy to start writing PRs for language-gfm. |
Thanks, I'm going to take a look at them. |
@burodepeper I don't think your point on nested emphasis or emphasis in headers not being within the markdown spirit is right. In fact, if you look at the original markdown implementation, I would also be happy if CommonMark gained more prevalence. Github flavored markdown is already more or less CommonMark compliant, by the way. |
I'm going to close this since I just feel I'm not ready to understand this regex black magic yet. 😄 🔮 |
This will fix #84. Since I'm not a regex guru I got some inspiration from the
marked
package.Italic style fix
Bold style fix
Combined (?)
Handle styles on multiple lines. Example:
Before
After
Waiting for feedback if the direction is good, then I will continue. 😄
/cc @izuzak