logo
down
shadow

Can I use GitHub's Linguist as a replacement to Rouge in Jekyll


Can I use GitHub's Linguist as a replacement to Rouge in Jekyll

By : Amoscoder
Date : October 23 2020, 08:10 AM
it should still fix some issue
is there a way to use Linguist to tokenize and create CSS for highlighting server-side?
code :


Share : facebook icon twitter icon
Vertical Scroll bars in Jekyll Rouge

Vertical Scroll bars in Jekyll Rouge


By : Thailo Eduardo
Date : March 29 2020, 07:55 AM
hop of those help? Is there anyway to add vertical scroll bars in Jekyll for really long code? I tried adding a Height attribute in _syntax.scss but with no luck. The syntax highlighter I'm using is rouge and the theme I'm using is here: https://github.com/mmistakes/hpstr-jekyll-theme , Yes, make sure you add this CSS to your theme:
code :
pre.highlight {
  max-height: 200px; /* Change to your desired max height */
  overflow-y: scroll;
}
.highlight {
  [...]
  border: 1px solid #dbdbdb;
  background-color: #272822;
  border-radius: 3px;

/** This part **/
  max-height: 300px;
  overflow-y: auto;
}
Jekyll: how to not interpret jekyll / ruby lines in a code snippet (rouge)?

Jekyll: how to not interpret jekyll / ruby lines in a code snippet (rouge)?


By : Ediosn
Date : March 29 2020, 07:55 AM
it helps some times I have this snippet of code in a Jekyll post: , Surround code with
code :
 {% raw %}
{% endraw %}
Jekyll with Rouge and KaTeX cannot have $ in code

Jekyll with Rouge and KaTeX cannot have $ in code


By : user2227233
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I managed to get rid of errors by modifying tag from jekyll-katex to work around code (inline, use single tilde) and pre code (block made using indention or 3 tildes):
code :
# frozen_string_literal: true

require 'jekyll'
require 'jekyll-katex/configuration'
require 'jekyll-katex/katex_js'
require 'nokogiri'

module Jekyll
  module Tags
    # Defines the custom Liquid tag for compile-time rendering of KaTeX math.
    # This differs from the katex tag in that it allows use of `$` and `$$` fencing to mark math mode blocks similar to
    # standard latex.
    #   {% katexmm %}
    #   This is a mixed environment where you can write text as normal but fence off latex math using `$`. Escape
    #   using `\$`. For example.
    #   $latex math with \$$
    #   $$display mode latex$$
    #   {% endkatexmm %}
    class KatexMathModeFixed < Liquid::Block
      LOG_TOPIC = 'KatexMathModeFixed:'
      KATEX ||= Jekyll::Katex::KATEX_JS
      LATEX_TOKEN_PATTERN = /(?<!\\)([$]{2}|[$]{1})(.+?)(?<!\\)\1/m

      def initialize(tag_name, markup, tokens)
        super
        @markup = markup
        @tokens = tokens
        @display_mode_rendering = Jekyll::Katex::Configuration.global_rendering_options.merge(displayMode: true)
        @inline_mode_rendering = Jekyll::Katex::Configuration.global_rendering_options.merge(displayMode: false)
      end

      def render(context)
        enclosed_block = super
        fixed_block = fix_code(enclosed_block)
        rendered_str = fixed_block.to_s.gsub(LATEX_TOKEN_PATTERN) do |match|
          display_mode = match.to_s.start_with? '$$'
          rendering_options = display_mode ? @display_mode_rendering : @inline_mode_rendering
          Jekyll.logger.debug LOG_TOPIC, "Rendering matched block - #{match}"
          KATEX.call('katex.renderToString', Regexp.last_match(2), rendering_options)
        end
        # KaTeX should fix escaped `$` within fenced blocks, this addresses instances outside of math mode
        rendered_str.to_s.gsub(/\\[$]/, '$').to_s
      end

      def fix_code(input)
        updated = false
        html = Nokogiri::HTML.fragment(input)
        Jekyll.logger.debug LOG_TOPIC, "Fixing - #{input}"
        html.css("code, code span").each do |c|
          if c.css('*').empty? && c.content['$']
            updated = true
            Jekyll.logger.debug LOG_TOPIC, "current tag - #{c}"
            content = c.content
            content['$'] = '\$'
            c.content = content
            Jekyll.logger.debug LOG_TOPIC, "current tag now - #{c}/#{content}"
          end
        end
        output = html.to_s
        Jekyll.logger.debug LOG_TOPIC, "Fixed - #{output}"
        if updated then html.to_s else input end
      end
    end
  end
end

Liquid::Template.register_tag('katexmmx', Jekyll::Tags::KatexMathModeFixed)
Jekyll not highlighting with rouge highlighter

Jekyll not highlighting with rouge highlighter


By : Suhel
Date : March 29 2020, 07:55 AM
like below fixes the issue There is three ways to write code snippets in jekyll :
1 - jekyll highlight
Highlight Liquid with Rouge & Jekyll

Highlight Liquid with Rouge & Jekyll


By : Maheswari
Date : March 29 2020, 07:55 AM
it should still fix some issue I am trying to highlight a block of liquid and html code, but it doesnt seem to be working. All other languages work fine.
code :
{% highlight liqiud %}
Related Posts Related Posts :
  • root undoing previous changes after sudo su user
  • Create X509 Certificate from.p12 or .pem certificate
  • Keras layer.set_weights doesn't modify the layer. Why?
  • Available build tasks in TFS 2017
  • Change oracle apex database user
  • How to parse typesafe config with objects
  • Is "Comment" a protected word in the Open API 3.0 spec or Swagger Editor?
  • Display Percentage in a Row in Tableau
  • Bokeh Colorbar Vertical title to right of colorbar?
  • Why the multi-ports model can't import into C++?
  • Nativescript tab page textfield
  • Why does this greedy algorithm work?
  • Nested list mapping using MapStruct
  • How to I find the original row index of a table in a google visualization if I have a filtered rows view
  • Ribbon icon doesn't show up in Word Online
  • Fitting user defined function with MPFIT in IDL
  • yii2 user CRUD create or update with password
  • Does Perl 6 performance suffer by using rationals for decimal numbers
  • How to get Y value at a given X value of a trendline
  • ElastAlert flatline not finding results
  • CSS not extracted for common chunk with extract-text-webpack-plugin
  • Adding element to nested vector
  • How can I trigger an action after updating a Podio Category on zapier?
  • Ninject.MVC5 Release Scope Never Called - OutOfMemoryException
  • Grok custom time format
  • How can I avoid Same Origin Policy exception when using AWS API Gateway and CloudFront
  • How to test ActionCable with Capybara and poltergeist inside Docker?
  • opendaylight: how to include a library jar file?
  • OpenThread using Nest Learning Thermostat
  • In Coq, how to remove a defined variable from the namespace?
  • Adobe DTM Mobile Tracking Rules
  • Accessing Vuex submodules inner state with the $store object
  • Include one widget instead of excluding all others
  • Create folder temp in mac using lotuscript
  • RSU placement in veins/SUMO
  • Exclamation Unary operator stopped working on bindings
  • RxJs how to merge two overlapping observable into one
  • How to add Nuget Package Source at runtime?
  • Absolute positioning a FlatList item react-native
  • Python, using variables in pymodbus.utilities.computeCRC
  • Akamai CDN - Whitelist service by Request header or User agent
  • UIWebView/WKWebView crash on iOS11 (ran out of executable memory)
  • Is ZonePlayerId capability still working?
  • Testing polynomial definition (from natural numbers to integers)
  • Wakanda 2.x cannot set certain tables' scope to publicOnServer
  • Call task from another Verilog module
  • Perl 6 transforms combined graphemes?
  • How to get automake to set libdir to /usr/lib64 on dual-arch Linux platforms
  • Restore RSA private key by modulus, public and private exponents using Java Security
  • Visual Studio 2017 Reset Settings
  • SonarQube 6.5 - Not able to trigger TFS Build Definition
  • Composing tweet in Twitterkit since Xcode 9 with Swift 4 & IOS 11
  • Custom Bing Map Type Issue
  • How to update MvvmCross?
  • pageFunction in Puppeteer returns empty object
  • PyCharm Run --- why does it sometimes display a traceback and error and sometimes not?
  • Yii2, optional parameter in the rounte
  • Hive and Pig on top of same dataset
  • SCM_REPOSITORY_PATH being ignored on Azure web app
  • Pentaho Flow Input->Output->Input not working
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org