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

I am worried about the other tags used between <span></span>. #1

Open
maoxiaoke opened this issue Jun 13, 2017 · 1 comment
Open

I am worried about the other tags used between <span></span>. #1

maoxiaoke opened this issue Jun 13, 2017 · 1 comment

Comments

@maoxiaoke
Copy link

I am trying to use <i></i> between <span></span> like this:

<span data-ty="input"  data-ty-prompt="#"><i>hello world. </i></span>

It seems not working. What should i do ?

@ines
Copy link
Owner

ines commented Jun 13, 2017

What are you trying to achieve with this? Do you want the text to be italicised, or do you want to actually print <i>hello world.</i>?

If you want the text to be in italics, I would do that styling in CSS. Either by adding a custom class, or by tying it to the prompt or some other attribute, e.g.:

[data-ty-prompt="#"] {
    font-style: italic;
}

Usually, there's always some logic to how things should be styled – for example, all commands with a certain prompt should be styled a certain way, or all non-animated output should be italicised etc. In cases like this, it always makes more sense to actually specify a certain style for a data attribute or combination of attributes.

If you want to actually print the raw HTML, just escape the characters:

<span data-ty="input"  data-ty-prompt="#">&lt;i&gt;hello world.&lt;/i&gt;</span>

In the long run, maybe it does make more sense to simply read off the innerHTML of a <span> instead of its textContent... I'll think about this!

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

No branches or pull requests

2 participants