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

Markdown: Too greedy italic punctuation #1849

Closed
RunDevelopment opened this issue Mar 30, 2019 · 1 comment · Fixed by #1897
Closed

Markdown: Too greedy italic punctuation #1849

RunDevelopment opened this issue Mar 30, 2019 · 1 comment · Fixed by #1897

Comments

@RunDevelopment
Copy link
Member

Information

  • Language: Markdown
  • Plugins: none

Description
The punctuation of italic text with * and _ will match any number of leading *s and _s.

Scratch and bold have similar issues.

Code snippet

*__foo__* or _**bar**_

image


I want to mention that this bug is trivial to fix using #1679.
Possible solution:

// Allow only one line break
pattern: /(^|[^\\])([*_])((?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?)(\2)/,
lookbehind: true,
greedy: true,
groups: {
	$2: 'punctuation',
	$4: 'punctuation',
}

Support for nested styles could be added with $3: Prism.languages.markdown.

@ghost
Copy link

ghost commented Jun 24, 2019

Can confirm. The behaviour of PrismJS and GitHub markdown is the same. Both do not implement bold italics as expected:

# Chapter Title

A **bold** sample.

## Section Title

An _italicised_ sample.

### Subsection Title

A **_bold italicised_** sample.

When converted from Markdown to PDF (via pandoc and ConTeX), the output resembles:

ci-output-04

PrismJS produces the following:

prismjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant