Git Product home page Git Product logo

code-syntax-block's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-syntax-block's Issues

Changing language keywords

I am using Code Syntax Block for highlighting R code on my wordpress site. However, a lot of relevant keywords are missing. I tried to edit prism-r.min.js in the plugin editor in order to add more keywords (like rnorm, plot, runif, library,...), but the chagnes are not shown on my wordpress site. Any way to achieve this?

customize the language list and set a default language

is there a way to rank the list of language based on popularity(e.g. TIOBE ranking or something), or just let me customize a few and set a default one?

it's a bit time consuming each time to drag down the list and pick the language.

thanks for this plugin, very useful and probably the only way to get code highlighted in gutenberg as I know it.

PHP code blocks are not highlighted

Thanks for the plugin! Looking over it was a great learning experience on how to modify the default content blocks.

You do mention PHP support, and PHP is listed in the selection menu, but it doesn't work right now.

The reason for that is quite trivial - the Prism minified package you include with the plugin was not built with PHP support (the other languages you mentioned are properly included).

This is kind of a non-issue and very easily fixable by just dropping another version of Prism there - a thing that one needs to do anyway in case they want to use any language you didn't include; but a bug is a bug.

How to reproduce

  1. Create a post with a Code block
  2. Insert valid PHP code
  3. Select "PHP" in the language selection dropdown
  4. Save/publish

The resulting code block is not highlighted. No JS errors or warnings are emitted.

Styles not applied to dynamically added posts

Posts that are added to a post feed via an AJAX call do not seem to have styles applied from the Code Syntax Block plugin. Is there a way to automatically catch newly added content or a way that restyling could be triggered on elements after such content has been added? You can see this issue here when you load more posts.

Change the CSS path is not valid

function prism_css_path(){
	return '/assets/prism/prism-darcula.css';
}
add_filter('mkaz_prism_css_path', 'prism_css_path', 1);

I added a filter, but it didn't seem to work.

make horizontal scroll bar small

I'm using latest version of code-syntax-block.
when I see my code snippets in the chrome browser (latest version), I see large horizontal scroll bar.
How can I make it small?

I'm using default code-syntax-block.
below is the image.

Capture

above big scroll bar won't appear in the mobile view as large as this. also in the latest firefox browser as well.

Safari (macOS) with long lines SOLVED

The code blocks look good in Chrome (Windows) and Edge but in Safari (macOS) the long lines are justified, the block does not show the scroll bar and the appearance of the block is not as good.
Thanks, Emilio.
csb

Enhancement: Inline Code Highlighting

Prism supports inline highlighting, it'd be neat if this plugin could make use of that.

I'm not sure if the existing code format button can be extended to add a highlighting option, or if it would need to be replaced.

The inline image format button is a potential model for showing a language selection dropdown. Alternatively, I think it could be reasonably added to the sidebar when the cursor is on the inline code.

Adding New Languages

Prism can be built with a very large set of languages, I've slimmed this down to only the ones I publish with but for others to use the plugin, they may build their own unique set of languages.

How do we customize the language list without requiring a lot of forking and JS twiddling.

HTML validator Error: Bad value for attribute lang on element code

I'm using the Code Syntax Block plugin with the R programming language. I checked the HTML of one of my posts with the html validator (https://validator.w3.org/). But I am getting this error in every code block:

Error: Bad value r for attribute lang on element code: The language subtag r is not a valid language subtag.

The problem arises with the lang attribute:

<code lang="r" class="language-r">  

I also checked the HTML with a Dart language code block and I get the following:

Bad value dart for attribute lang on element code: Found reserved language tag: dart.

However, if I manually delete the lang attibute, everything seems to work and the error disappears. Is this attribute necessary? Did I a mistake somewhere?

Thanks!

Resource Intensive

Enabling the latest build of the plugin causes a heavy load on the front end.

Enable/disable line numbers

Hey,
an option to disable/enable line numbers in the code block would be awesome. Just an toggle switch in the code block options.
Line numbers can look like this:
image

Best regards,
Jonas

Listing Languages in Block

The ability to list images in the BlockControls looks limited, requires using an icon and not text.

I need to investigate further and how to implement, I think I'd prefer a dropdown to select the image. Plus I think it makes sense to do so in the BlockControls and not Inspector.

Bug: Title not displayed if no language defined

Hey,
thanks for maintaining and keeping this plugin up to date! It is already working quite good for me but there is one bug for me. The code block title is not displayed if no language is defined.
Hope this is fixable in a easy way :)

Best regards,
Jonas

Readme should specify how to build

You will also need to edit the langs array in code-syntax.js and rebuild.

Building this project is necessary for anyone who wants to add other languages, but some may not be javascript developers and may not know how to build.

External Stylesheet - mkaz_prism_css_url

I tried to change the Prism theme using the mkaz_prism_css_url hook in functions.php, but it is not working for me (nothing changes). I tried the following:

apply_filters( 'mkaz_prism_css_url', 'https://cdn.jsdelivr.net/gh/atelierbram/syntax-highlighting/prism/demo/assets/css/prism-base16-brewer.light.min.css' );

Am I doing it wrong?

Thank you,
Daniel

Double click on code box to enable edit mode

Hey,
this feature is a bit optional but maybe usefull: Double click on code box to enable edit mode for easier copying (ctrl+a select all etc.)
Could look like this:
image
A small toggle switch to enable/disable selection feature in the code block options should be added.

Best regards,
Jonas

Support customizing js/css w/o breaking BC

Following the established templating pattern of many popular WP plugins, I venture that an updated prism.js or prism.css should be dropped into your theme and that should take precedent over the plugin version, rather than overwriting the plugin version, which would be lost in an update.

Happy to tackle this. I'll update with a PR when I get a chance, probably before the new year.

Conditional loading problem

Hi,
you've added conditional loading of the js and css scripts in the last update. This causes problems on my blog because i am loading some blocks with get_pages etc.
Could you please add an option page and make the conditional loading optional? That would be awesome.

greets
Talha

How to use with ThemeCo X Pro theme

I'm trying to get this working with ThemeCo X Pro theme. When using ThemeCO X Pro editor the is no option for a code block. Do you know if and how I can use your plugin with their theme?

Tab added between forward slash and hashtag in bash and nix langs

Hi

I was trying to highlight some FreeBSD commands, which uses sh - the closest syntaxes I found were bash and nix, so I tried each of those and both of them added a tab between the / and the # characters - they are right next to each other in the prompt, like /#
image

By the way, very nice work otherwise. Thanks a lot for your development.

Optional title for code block

Hey,
first of all thanks for this nice and simple plugin, I really like it!
It would be cool to be able to define custom tiles for the code blocks like here (deprecated Crayon Syntax Highlightner):
image
This is usefull if you reference code snippets which belong to files etc.

An text field in the code block options would be enough (underneath the code language selection).

Best regards,
Jonas

With latest gutenberg update, the code syntax plugin broke

Hi. The latest update to Gutenberg apparently (version 3.2.0) broke the bloke editing. I am now getting "an unknown error occurred".

I tried deactivating all plugins apart from gutenberg and code syntax block and I still get the error.

The old posts with code syntax is still working on the front-end but the backend errors out like in the new post.

Can't see language-setting in Inspector

Hi there,
I'm using Classic Paragraph and titles for my blog. Running Classic Paragraph doesn't show me any language-settings in Inspector as you wrote in "Usage" of the plugin.
So nothing changed so far.
What is the solution?

EDIT: I found out that there was an interference coming from other plugins: TinyMCE Advanced and Classic Editor. I decided to switch to classic editor because I can't get lucky with Gutenberg.

bildschirmfoto von 2019-01-02 12-49-28

Validation Error if Plugin Disabled (Editor view)

When plugin is used to create syntax blocks, if you disable the plugin then the blocks in the editor will have a parse error with the blank language attribute. You can "Convert to Blocks" and it will recreate the core block.

This does not effect the post view, only when editing after disabling plugin.

1st character indentation

The first character of my blocks is indented and I don't see any extra characters or a way to get rid of this. Below are several examples.

Annotation 2019-09-18 120024

Annotation 2019-09-18 120058

Unsure if issue, language settings disappear

Hi there, dont know if is an issue or maybe i'm doing wrong. I'm using this plugin since first version, so i suppose how is to be used. Update last days and now i see the block code, but on right language-settings selector is lost. No probs on logs, no issue on screen. I'm only one with this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.