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

The EnlighterJS engine turns inline elements to block elements #2

Closed
twhitehead opened this issue May 20, 2021 · 7 comments
Closed
Assignees
Labels
Bug Something isn't working

Comments

@twhitehead
Copy link
Contributor

twhitehead commented May 20, 2021

Noticed all my inline elements are being turned into block elements by the EnlightnerJS engine as shown in this screenshot from our moodle (clearly I didn't want ssh broken out into its own line each time!)

moodle-issue

From the manual, the first argument passed to the EnlightnerJS.init is a selector for block elements, and the second for inline elements. This plugin calls EnlightnerJS.init with the same pre (block) and code (inline) selector specification for both

EnlighterJS.init('synhi pre, synhi code', 'synhi pre, synhi code', {theme: '".$config->enlighterjsstyle."', indent : 4});

I expect this is can be resolved by simply only specifying the block elements (pre) for the first and only the inline elements (code) for the second

EnlighterJS.init('synhi pre', 'synhi code', {theme: '".$config->enlighterjsstyle."', indent : 4});
@gjb2048
Copy link
Collaborator

gjb2048 commented May 20, 2021

@twhitehead Thanks for the patch, please could you supply some testing instructions and data.

@twhitehead
Copy link
Contributor Author

twhitehead commented May 21, 2021

No problem, and thanks for the very quick reply. If you create a moodle page in html mode (e.g., a lesson) with the following context

You can run the command <code>ls -l</code> to list all your files in long format.

and enable your plugin with the EnlighterJS engine, you should see that it renders the inline command as a block item (i.e., on its own line) like so

You can run the command
ls -l
to list all your files in long format.

instead of an inline (i.e., inside the line) like it should

You can run the command ls -l to list all your files in long format.

Reloading the page (possibly a shift+F5 will be required to avoid the browser caching the old version) after applying the patch should fix this.

@gjb2048 gjb2048 added the Bug Something isn't working label May 22, 2021
gjb2048 added a commit that referenced this issue May 22, 2021
Correct EnlighnerJS.init block and inline selectors (close #2)
@gjb2048 gjb2048 reopened this May 22, 2021
@gjb2048
Copy link
Collaborator

gjb2048 commented May 22, 2021

@twhitehead Sorry for the delay, just tested and accepted. Thanks for the test information. I'll just need to update the PHPUnit test. Also, I tested on M3.11, so the filter should be ok there too.

gjb2048 added a commit that referenced this issue May 22, 2021
@twhitehead
Copy link
Contributor Author

No worries. That was plenty quick. 😁

Thanks so much for doing the testing for me.

gjb2048 added a commit that referenced this issue May 22, 2021
@gjb2048 gjb2048 closed this as completed May 22, 2021
@gjb2048
Copy link
Collaborator

gjb2048 commented May 22, 2021

@twhitehead No problem, I've just credited you in the readme and I'm going to do a proper release on Moodle.org soon.

@gjb2048
Copy link
Collaborator

gjb2048 commented May 22, 2021

@twhitehead
Copy link
Contributor Author

Excellent. I'll see if our admin will update us now! Thanks again. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants