• Resolved ronisbr

    (@ronisbr)


    Hi!

    I really like your code block and I would like to use it instead of Crayons. Is it possible to add support for Julia language?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author maximebj

    (@maximebj)

    Hi !

    It’s a language included in CodeMirror so I can (https://codemirror.net/mode/)

    You can use my filter to add your language :

    
    function my_custom_languages( $languages ) {
        $languages[] = array('slug' => 'julia', mode => 'julia', 'label' => 'Julia') ;
    
        return $languages;
    }
    add_filters( 'advanced_gutenberg_blocks_code_languages', 'my_custom_languages' ); 
    

    Tell me if it works

    Thread Starter ronisbr

    (@ronisbr)

    Yes it works fine! However, the editor in Gutenberg has an bug related to the cursor position: https://imgur.com/a/dD26z4n

    Take a look where I am writing and the cursor position.

    • This reply was modified 5 years, 10 months ago by ronisbr.
    Plugin Author maximebj

    (@maximebj)

    I had this bug but finally fixed it. But not enough : the issue is with CSS line-height.

    I’ve set it to 28px to fit Gutenberg default styles. But ifyou made changes in the theme you should update this value (I’ll try later to see if a inherit should fix the issue everytime)

    do you have an editor-styles.css ? If yes you can add :

    
    .CodeMirror pre {
      line-height: 24px; // Change the value
    }
    
    Thread Starter ronisbr

    (@ronisbr)

    It changed the format, but I could not find a single value that makes things work, unfortunately.

    Thread Starter ronisbr

    (@ronisbr)

    By the way, I am using the twenty fourteen theme with only one style configuration:

    .site-content .entry-header,
    .site-content .entry-content,
    .site-content .entry-summary,
    .site-content .entry-meta,
    .page-content {
    	max-width: 800px;
    }
    Thread Starter ronisbr

    (@ronisbr)

    Hi @maximebj,

    With your advice I managed to make something very nice and usable now! I added the following code to editor-style.css:

    .CodeMirror pre {
      line-height: 24px;
      margin: 0;
      padding: 0 0 0 5px;
      border: none;
    }

    Then I got: https://imgur.com/6vNA2tk which is just wonderful! The best code block / plugin I have ever used! Clean, simple, elegant! Congratulations!

    P.S.: The photo is the editor, not the one in the website!

    • This reply was modified 5 years, 10 months ago by ronisbr.
    Plugin Author maximebj

    (@maximebj)

    Nice !

    I’ll try to find a value that fit everytime in the future to avoid issues with line-height (if it’s possible).

    I’m alos publishing a new release today with a lot of fixes.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add support for Julia Language’ is closed to new replies.