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

Customize isHTML url pattern not only "htm|html|xhtml|php" #789

Closed

Conversation

xiaohui-zhangxh
Copy link

@xiaohui-zhangxh xiaohui-zhangxh commented Nov 5, 2022

I think this pattern can not only assume .htm, .html, .xhtml, .php is a HTML page, but also .jsp, .asp, .whatever ...

export function isHTML(url: URL) {
  return !!getExtension(url).match(/^(?:|\.(?:htm|html|xhtml|php))$/)
}

I found this issue when I'm integrating monaco-editor to edit source code online, url looks like http://tanmer.lvh.me:3000/themes/-/ide/theme/1/edit/version/1/-/assets/cart-drawer.js , this URL is not a javascript, it's a HTML page to edit cart-drawer.js

With this PR, I can customize my own pattern to identify HTML page:

  <head>
    <meta name="turbo-html-url-pattern" content="\/-\/ide\/theme\/\d+\/edit\/version/\d+\/-\/"/>
  <./head>

@brunoprietog
Copy link
Collaborator

Addressed in #1230

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

Successfully merging this pull request may close these issues.

2 participants