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?
Comment | File | Size | Author |
---|---|---|---|
#10 | geshifilter-wrong_instructions-2703721-10.patch | 1.88 KB | swarad07 |
#4 | geshi2.PNG | 8.89 KB | flyingdoggy |
#4 | geshi1.PNG | 9.7 KB | flyingdoggy |
Comments
Comment #2
flyingdoggy CreditAttribution: flyingdoggy commentedComment #3
yukare CreditAttribution: yukare commentedI 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.
Comment #4
flyingdoggy CreditAttribution: flyingdoggy commentedHi 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:
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:
Comment #5
yukare CreditAttribution: yukare commentedNext 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.
Comment #6
flyingdoggy CreditAttribution: flyingdoggy commentedThanks, 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...
Comment #7
yukare CreditAttribution: yukare commentedTry 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.
Comment #8
flyingdoggy CreditAttribution: flyingdoggy commentedIt 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.
Comment #9
yukare CreditAttribution: yukare commentedI do not know why ckeditor comment the php code, i use it and i do not have this issue.
Comment #10
swarad07Hi,
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?
Comment #11
sepeck CreditAttribution: sepeck as a volunteer commentedI 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.
Comment #12
rajeshwari10 CreditAttribution: rajeshwari10 as a volunteer and at Blisstering Solutions commentedComment #14
yukare CreditAttribution: yukare commentedCommited to git, thanks.
Comment #16
Shivalik CreditAttribution: Shivalik as a volunteer commentedINSTALLATION (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!!