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

Embed code #1

Closed
KSXGitHub opened this issue May 11, 2017 · 12 comments
Closed

Embed code #1

KSXGitHub opened this issue May 11, 2017 · 12 comments

Comments

@KSXGitHub
Copy link

I want to display some code in slide without having to edit its source code

@linux-man
Copy link
Owner

linux-man commented May 11, 2017

Near the end of the demo you have a slide with code syntax highlight. Is that what you need?
On edit mode:
Formats > Blocks > Pre followed by Formats > Inline > Code

@KSXGitHub
Copy link
Author

Yeah, but I don't see any option to change language (for highlighting)

image

@linux-man
Copy link
Owner

That should be automatic. It uses highlight.js, where you can read:

174 languages and 77 styles
automatic language detection
multi-language code highlighting

and a lot of other good stuff.
You really have to finish editing to see how it looks.

@KSXGitHub
Copy link
Author

I don't know how many lines I have to write to get highlighting works but sometime I just want to write a short code. Furthermore, I don't think auto language detection is good enough, user should be able to choose language.

image

@linux-man
Copy link
Owner

imagem
You aren't doing it right!
Code must be inside <pre><code> tags. With
imagem
you get
imagem
Automatic detection may fail. You can choose a language by adding a class to code tag, like this

<pre><code class="javascript">
var car = {type:"Fiat", model:"500", color:"white"};
document.getElementById("demo").innerHTML = car.type;
</code></pre>

The language list is here.
Before you ask, there's no way to change highlight style.

@KSXGitHub
Copy link
Author

Is there any way to insert code without opening 'Source Code' dialog? Unreel is not a text editor (like Vim, Sublime, Atom, etc.), it should not ask user to do so.

@linux-man
Copy link
Owner

Yes. Do
imagem
imagem
and write or paste the code.
You can go to Source Code to choose the language.
Source Code should be used for special formating, and sometimes to clean the HTML mess you can do without knowing (HTML can be really messy 😃).

@KSXGitHub
Copy link
Author

Thanks.
Still, this is tricky. I guess very few people know this.
Can you just add one menu option (Formats > Blocks > Code)?

@linux-man
Copy link
Owner

I could, but I'm a purist: 1 option -> 1 format.
<pre> and <code> can stand on their own and be useful to someone...
imagem

@KSXGitHub
Copy link
Author

If "pure" means 1 option for 1 html tag, this makes sense
But if 1 option was meant to be 1 visual element, Format > Inline/Block > Code is make symetry

@linux-man
Copy link
Owner

  • We don't have to agree, just to understand each other.
  • I get your idea, but for now I'm not gonna change formats menu. The one place I wouldn't mind to add a "Syntax Highlight Code Block" would be at "Templates", where you can find other "complex" structures.
  • Those 1% that will use syntax highlight like you and me can understand these concepts better than the other 99% that don't need to show their code. After all, syntax highlight is a great "bonus", but seldom used.
  • Most important: YOU know how to do it.
  • Thank you for using Unreel.

@linux-man
Copy link
Owner

b6262ae
I'm closing this issue. Fell free to reopen it.

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