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

Allow links in the inside of code and pre element #16

Closed
wants to merge 5 commits into from

Conversation

yhatt
Copy link
Owner

@yhatt yhatt commented Apr 25, 2019

Until now, <a> tag in the inside of <code> and <pre> won't recognize as link. It is the correct behavior in regular Markdown's backtick(s), but not in Slack mrkdwn format and regular HTML. It allows link format <xxx|xxx> in the inside of inline code and fence.

For consistent HTML element support, we would require to change behavior as these:

  • Children in <code> and <pre> allow <a> tag and <time> tag.
<code><a href="https://example.com/">example</a></code>
<pre><a href="https://example.com/">example</a></pre>

スクリーンショット 2019-04-25 18 28 45

  • The raw mrkdwn still supports the link in code: `Hello, <https://www.example.com/|example>.` (Requires JSX string interpolation)
  • Use &lt; and &gt; via interpolation explicitly to escape link format.

Copy link
Owner Author

@yhatt yhatt left a comment

Choose a reason for hiding this comment

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

Re-considering

test/html.tsx Outdated
expect(html(<code>{'<#C01234567>'}</code>)).toBe('`<#C01234567>`')

// Work escape correctly
expect(html(<code>&lt;!channel&gt;</code>)).toBe('`&lt;!channel&gt;`')
Copy link
Owner Author

Choose a reason for hiding this comment

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

It seems to return same result as <code>{'<!channel>'}</code>. jsx-slack could not detect whether using escaped entity like &lt; and &gt;. This test case is still valid in using entities via JSX interpolation, like <code>{'&lt;!channel&gt;'}</code>.

@yhatt
Copy link
Owner Author

yhatt commented Aug 13, 2019

A base improvement #33 for this change was merged. This PR is too outdated, so I'll continue to work in another PR.

@yhatt yhatt closed this Aug 13, 2019
@yhatt yhatt deleted the allow-link-in-code-tag branch August 13, 2019 12:16
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.

1 participant