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

Support other backends #2

Open
henryiii opened this issue Jun 4, 2017 · 11 comments
Open

Support other backends #2

henryiii opened this issue Jun 4, 2017 · 11 comments

Comments

@henryiii
Copy link

henryiii commented Jun 4, 2017

The terminal plugin is great, but it doesn't work in ePub/PDF (didn't check mobi) backends. Would that be a possible to fix? Ace plugin is an example of one that colors multiple backends. Thanks for a great plugin!

@davidmogar
Copy link
Owner

Hi there @henryiii

Thanks for your suggestion! Actually it wasn't the main goal of this plugin but would be cool to be able to put some nice colors in PDFs too. I have no idea how to do it though. I'll check that plugin and GitBook docs whenever I have some spare time.

Again, thanks for your great comment. I appreciate 😉

@henryiii
Copy link
Author

henryiii commented Jun 4, 2017

First thing to do would be to at least remove the **[... parts from showing up on the other backends. Then add color if possible. :)

@davidmogar
Copy link
Owner

Sure. At our organization we don't use any backend (just the generated website) so we actually don't care about for the behavior. But you are more than right. I'll try to fix it 😉

@henryiii
Copy link
Author

The problem was that this plugin was built around page loads, which doesn't happen for PDFs. I've built a new version (rewritten completely except for .css file) that works on all backends and has named regexp powered colorization: https://github.com/CLIUtils/gitbook-plugin-term .

@davidmogar
Copy link
Owner

Hi @henryiii,

I think is better to update a project than split it and have two versions. Also, I'm not sure about some parts of your code and it will require proper tests.

As I told you, I'll fix this, but right now I don't have the time. I'm focusing all my efforts in cucco. Once this is done (around July 5th) I'll start refactoring the code.

Cheers.

@henryiii
Copy link
Author

henryiii commented Jun 14, 2017

The problem with updating it is that I didn't want to keep backwards compatibility with the **[prompt] syntax, and I assumed that would be important to you. I'm happy to help with any changes you'd like to use, but it's quite different. It's based on gitbook's {% %} syntax for blocks, so it is a completely different project with different structure.

An example of this on a page: https://henryiii.gitbooks.io/goofit/goofit/goofit-installation.html

@davidmogar
Copy link
Owner

Hi again @henryiii,

If the code is broken or an enhancement is possible (e.g. GitBook syntax blocks) an issue is welcomed. As I said, I plan to fix this. Pull request are fine too, but given the impact of this change maybe an issue is the most appropriate thing.

Having said this, I would appreciate if you unpublish the plugin from npm. This is totally up to you given the license, but would be nice to have a single plugin. Of course some attribution will me made to you in for your suggestions in the form of mention in the next release.

Cheers.

@henryiii
Copy link
Author

henryiii commented Jun 14, 2017

I'll look at finding a way to combine the plugins. The main features I'd like to retain (including the one listed at the top of the issue):

  • Uses {% block %} syntax
  • Defaults can be set, changed in each block if needed
  • Auto colorization using regexp
  • default color style that mimics normal code blocks (spacing and formatting, too).
  • Replaces copy per line buttons with copy all button (using clibboard.js). Manually selecting a line is not too hard, selecting a whole block is. Could be an option, though.

I won't have time to work on merging these for a while. I've unpublished the plugin for the moment and will use the GitHub link for now. I designed it to work side-by-side with this one, so I don't think it would have been a big issue to have two plugins, each with a different syntax. (I don't like the idea of self-parsing or running code on page load - though your syntax might be possible using the code option). I'm happy to give you full access to the term one.

Edit: Presented PR, please review and advise.

@henryiii
Copy link
Author

Correction: Now I've unpublished it. It's not trivial to remove a package from npm...

@henryiii
Copy link
Author

henryiii commented Oct 17, 2017

Ping! It's been months, and this functionality is still not available except in my fork. I unpublished my new package assuming you were interested in maintaining this...

My PR is still waiting.

@henryiii
Copy link
Author

henryiii commented Nov 8, 2017

Republished gitbook-plugin-term. This time, I also support language-based colorization, so you can just use term as the highlighting language after the three back-ticks. The only code that's part of terminal also is about 80% of the css file. I've used a different name everywhere so the two plugins do not clash. And the old **[termainl] syntax is not used in term.

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