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

[#93] Add support for basic html tags #259

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Sereja313
Copy link
Member

@Sereja313 Sereja313 commented Dec 23, 2022

Description

Problem: HTML tags can be used in a markdown file. We should add support for basic HTML tags embedded in markdown file.

Solution: Add support for image tags <img src="link">, anchor hyperlinks <a href="link">Text</a> and anchor target locations <a name="loc"> or <a id="loc">.

Related issue(s)

Fixes #93

✅ Checklist for your Pull Request

Ideally a PR has all of the checkmarks set.

If something in this list is irrelevant to your PR, you should still set this
checkmark indicating that you are sure it is dealt with (be that by irrelevance).

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
  • Public contracts

    • Any modifications of public contracts comply with the Evolution
      of Public Contracts
      policy.
    • I added an entry to the changelog if my changes are visible to the users
      and
    • provided a migration guide for breaking changes if possible

Stylistic guide (mandatory)

✓ Release Checklist

  • I updated the version number in package.yaml.
  • I updated the changelog and moved everything
    under the "Unreleased" section to a new section for this release version.
  • (After merging) I edited the auto-release.
    • Change the tag and title using the format vX.Y.Z.
    • Write a summary of all user-facing changes.
    • Deselect the "This is a pre-release" checkbox at the bottom.
  • (After merging) I updated xrefcheck-action.
  • (After merging) I uploaded the package to hackage.

Problem: HTML tags can be used in a markdown file. We should add
support for basic HTML tags embedded in markdown file.

Solution: Add support for image tags (<img src="link">), anchor
hyperlinks (<a href="link">Text</a>) and anchor target
locations (<a name="loc"> or <a id="loc">).
@Martoon-00
Copy link
Member

1 Error
🚫 Some fixup commits are still there.

Generated by 🚫 Danger

Copy link
Contributor

@aeqz aeqz left a comment

Choose a reason for hiding this comment

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

Nice! I have left just some optional style comments and a suggestion for the test.

tests/golden/check-html/check-html.md Show resolved Hide resolved
src/Xrefcheck/Scanners/Markdown.hs Outdated Show resolved Hide resolved
src/Xrefcheck/Scanners/Markdown.hs Outdated Show resolved Hide resolved
src/Xrefcheck/Scanners/Markdown.hs Show resolved Hide resolved
src/Xrefcheck/Scanners/Markdown.hs Show resolved Hide resolved
-- The `cmark-gfm` package parses the link tag as three separate nodes:
-- `HTML_INLINE` with an opening tag, a `TEXT` with text in between,
-- and `HTML_INLINE` with a closing tag. So we keep the extracted link in a state and
-- try to get associated text in the next node.
Copy link
Contributor

Choose a reason for hiding this comment

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

As we have been discussing in recent PRs, this code seems to be more difficult to understand with each new feature that requires to modify it. At least, comments and separating chunks of code to functions help in clarifying it for the moment 👍

@Sereja313 Sereja313 requested a review from aeqz December 28, 2022 22:01
@Martoon-00
Copy link
Member

Part of me wants #276 to be done before merging this PR, but will see.

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.

Add support for basic html tags
3 participants