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

Add some possibility for custom tag ? #74

Open
craff opened this issue Jul 14, 2023 · 5 comments
Open

Add some possibility for custom tag ? #74

craff opened this issue Jul 14, 2023 · 5 comments

Comments

@craff
Copy link

craff commented Jul 14, 2023

I am doing an ocaml equivalent of php (but better) for simple_httpd, and currently I use two tags:

  • <script "type="ml">...</script> accept all ocaml lexical convention but does not allow for nesting html (I would prefer not to use string or ppx).
  • <ml>...</ml> accept nesting but does not accept characters like '&'.

Altough I could live with this it is not nice.

Do you see a way to make markup extensible with some custom tags ?

Here is an example of what I use:

      <li> views: <ml>
	  let _ = echo (string_of_int count);;
	  let _ = echo (if count mod 2 = 0 then
 	                  <p>even (<ml> ^ string_of_int count ^ </ml>)</p>
	                else <p>odd</p>)
	</ml>
      </li>

Which I find nice except for the special characteres.

I would also like if my <ml> tag could occur anywhere in the document.

@aantron
Copy link
Owner

aantron commented Jul 14, 2023

As I recall, Markup should already parse unknown custom tags in some default fashion, which is dictated by the spec. What is currently happening?

@craff
Copy link
Author

craff commented Jul 15, 2023 via email

@aantron
Copy link
Owner

aantron commented Jul 16, 2023

Lexical conventions in HTML vary for the content of various tags like <title> and <script>, and are determined by the tokenizer. You may be able to add something there, but this might be difficult to design and/or upstream into Markup.

@aantron
Copy link
Owner

aantron commented Jul 16, 2023

As I understand it, you want to have custom tags for which the lexical conventions for the content are similar to <script>, because in <script> & has no special HTML meaning.

@craff
Copy link
Author

craff commented Jul 17, 2023 via email

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

No branches or pull requests

2 participants