Hi,

First time trying to make GeSHi working in Drupal 8.

I put /geshifilter folder under /var/www/html/modules (also tried ~/sites/all/modules and ~/sites/default/modules)

Then I followed the instructions and put GeSHi libraries under ~/sites/all/libraries (also tried ~/sites/default/libraries, manually creating non-existing directories), I have tried ~/libraries/geshi/geshi.php (+the /geshi folder) and ~/libraries/geshi.php (+the /geshi folder). I am sure I used the correct version of GeSHi libraries.

I am not familiar with PHP but I guess the "libraries_load('geshi')" call in geshifilter.install loads the libraries and it failed to do so. But I am not sure why?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

flyingdoggy created an issue. See original summary.

flyingdoggy’s picture

Issue summary: View changes
yukare’s picture

I need to update the docs for drupal 8.
If the drupal root is /var/www/html:
The module goes into modules folder, so becomes /var/www/html/modules/geshifilter.
The library go to libraries, so becomes /var/www/html/libraries/geshi.

Important: the last version of geshi library contains a folder with some files like readme and a folder "src". You need to put the content of src folder into libraries/geshi, so you will have a file /var/www/html/libraries/geshi/geshi.php

Hope this helps.

flyingdoggy’s picture

FileSize
9.7 KB
8.89 KB

Hi yukare,

Thanks for the reply. I have put geshi libraries under /drupalroot/libraries, however it still does not work.

The directory structure looks like this:
directory structure

I am using Version 1.0.8.11 of the library, there is no "src" folder but there are a bunch .php files in "geshi" folder like these:
files

yukare’s picture

Next steps:
Do you have the libraries modules enabled? You need it, get it from https://drupal.org/project/libraries, and it goes to modules/libraries.

Assuming your site is http://example.com(change to real address of your site), go to http://example.com/admin/modules and enable "Geshi filter" and "Libraries".

Now go to http://example.com/admin/config/content/formats/geshifilter you will see a mesage like this "GeSHi library version 1.0.8.11 detected"

Now go to http://example.com/admin/config/content/formats and choose a format, like full html. Now enable the geshi filter.

Now create a new page with content, use the format you use above and enter something like this:

<code> <?php echo('hi'); ?> </code>

Using the source code, if you use the ckeditor, it will convert some chars and it will not work.

flyingdoggy’s picture

Thanks, I installed libraries module and now the geshi libraries can be detected.

I turned on all 3 modules in ~/admin/modules page at once and then the configuration of geshifilter would not detect the libraries, had to uninstall geshifilter then turn it back on.

There are other problems though, if I switch to CKEditor then switch back to source mode, the php code will get commented (turning into <!--?php echo('hi'); ?--> ).

Also tried C++ code, after switching back and forth the code loses the format (everything is in one line).

If I edit in source mode and finish the final touches there, then the end result will be what I want, but if I ever need to edit it, it will be a nightmare...

yukare’s picture

Try this: go to http://example.com/admin/config/content/formats/geshifilter, under Generic syntax highlighting tags make sure that "pre" is there.

In the node, go to source code and type:

<pre language="php">
<?php
echo('hi');
?>
</pre>

The ckeditor will do some changes/encoding with your code, but it will not add <br> tags and format anything inside a<pre>, so it will not be all in the same line.

flyingdoggy’s picture

It now keeps the format of the code, but switching between CKEditor and source mode still comments out the php code.

On the other hand, C++ code loses highlighting...

I have tried both GESHI_HEADER_PRE and GESHI_HEADER_PRE_VALID, cannot see any difference.

yukare’s picture

I do not know why ckeditor comment the php code, i use it and i do not have this issue.

swarad07’s picture

Version: 8.x-1.0-beta1 » 8.x-1.x-dev
Component: Miscellaneous » Code
Priority: Normal » Major
Status: Active » Needs review
FileSize
1.88 KB

Hi,

I ran into this issue when trying to setup this module. The instructions in README are for D7 and not correct for D8. This should be fixed IMO, otherwise people will not be able to configure the module without referring to this issue.

I have provided a small patch which addresses this issue, this patch will provide clear instructions on how to setup the module and get it working.

Any other issues regarding how to configure the module can be a separate issue perhaps?

sepeck’s picture

I installed via the comments in this thread and the patch instructions in comment #10. Please commit soon as the incorrect instructions in the current downloaded halted me completely. These instructions resolved it.

rajeshwari10’s picture

Status: Needs review » Reviewed & tested by the community

  • yukare committed 1947b10 on 8.x-1.x authored by swarad07
    Issue #2703721 by swarad07: GeSHi libraries missing for Drupal 8
    
yukare’s picture

Status: Reviewed & tested by the community » Fixed

Commited to git, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Shivalik’s picture

INSTALLATION (Drupal 8)
------------
1. Extract the GeSHi Filter module and place the entire geshifilter in modules folder

2. Download the GeSHi library from
https://sourceforge.net/projects/geshi/

The path to geshi.php should be, /libraries/geshi/geshi.php

3. You will need the libraries module, download if you don't have it and enable it.

After enabling libraries module, enable gesh module :
1) GeSHi field and
2) GeSHi Filter

Then to check the configurations go to:
Configuration > Content authoring > Geshifilter
OR admin/config/content/formats/geshifilter

If your library is detected, it should show something like below,
GESHI LIBRARY VERSION 1.0.9.0 DETECTED

Hope this helps!!