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

[WIP]fix cm examples 569, 572 etc #1478

Closed
wants to merge 1 commit into from
Closed

[WIP]fix cm examples 569, 572 etc #1478

wants to merge 1 commit into from

Conversation

Jocs
Copy link
Contributor

@Jocs Jocs commented Apr 19, 2019

Marked version: 0.6.2

Markdown flavor: CommonMark

related issue #1474

Description

Remove * in alt attributes because of:

An image description has inline elements as its contents. When an image is rendered to HTML, this is standardly used as the image’s alt attribute.

Fixed commonmark examples

https://spec.commonmark.org/0.29/#example-569

https://spec.commonmark.org/0.29/#example-572

https://spec.commonmark.org/0.29/#example-573

https://spec.commonmark.org/0.29/#example-581

https://spec.commonmark.org/0.29/#example-585

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@Jocs Jocs changed the title fix cm examples 576, 579 etc fix cm examples 569, 572 etc Apr 19, 2019
@Jocs
Copy link
Contributor Author

Jocs commented Apr 19, 2019

@styfle I found the CI failed due to the compiled tests, but how to modify the compiled tests test cases?

@styfle
Copy link
Member

styfle commented Apr 19, 2019

@Jocs There is a test failing

#14. Test cm_links
    failed in 3.611ms
    Expected: ple 5440</h3><p><img alt="foo *bar*544" src="train.jpg"
      Actual: ple 5440</h3><p><img alt="foo bar544" src="train.jpg"

This is in the /test/new/cm_links.md and /test/new/cm_links.html files.

@styfle
Copy link
Member

styfle commented Apr 19, 2019

@UziTech Should we just remove this failing test since CommonMark covers it?

@UziTech
Copy link
Member

UziTech commented Apr 19, 2019

We could remove those. They are used for benchmarks but I will rewrite the benchmarks to use the new tests.

It looks like your code removes all * even when it is not part of an inline element.

marked demo
commonmark demo

@Jocs
Copy link
Contributor Author

Jocs commented Apr 19, 2019

It looks like your code removes all * even when it is not part of an inline element.

question 1

My fault, I found another question, commonmark only removed inline code, em, strong, link, autolink's marker, but still keep html_tag. like bellow:

markdown:
![val <u>hello</u>](src)

output html:
<p><img src="src" alt="val <u>hello</u>" /></p>

question 2

I think if we want to remove the marker in the inline syntax, we need to do inline lexer the alt text, but marked inline lexer and render are currently coupled together, the inline lexer does not generate a AST, so it is not convenient to extract the text from inline syntax?

@Jocs Jocs changed the title fix cm examples 569, 572 etc [WIP]fix cm examples 569, 572 etc Apr 19, 2019
@UziTech
Copy link
Member

UziTech commented Dec 4, 2019

I'm going to close this as the issue is covered by the spec tests. If you want to continue on this work make sure you update code in the /src/ folder.

@UziTech UziTech closed this Dec 4, 2019
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.

3 participants