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

Add an option to enable Rouge's plaintext lexer #572

Closed
ashmaroli opened this Issue Jan 23, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@ashmaroli
Copy link
Contributor

ashmaroli commented Jan 23, 2019

Use case

~~~ruby
class Foo
  def bar
    puts 'Hello'
  end
end
~~~

~~~text
class Foo
  def bar
    puts 'Hello'
  end
end
~~~

~~~
class Foo
  def bar
    puts 'Hello'
  end
end
~~~

Actual Output

<div class="language-ruby highlighter-rouge">
  <div class="highlight">
    <pre class="highlight">
      <code>
        <span class="k">class</span> <span class="nc">Foo</span>
        <span class="k">def</span> <span class="nf">bar</span>
        <span class="nb">puts</span> <span class="s1">'Hello'</span>
        <span class="k">end</span>
        <span class="k">end</span>
      </code>
    </pre>
  </div>
</div>

<pre>
  <code class="language-text">
    class Foo
      def bar
        puts 'Hello'
      end
    end
  </code>
</pre>

<pre>
  <code>
    class Foo
      def bar
        puts 'Hello'
      end
    end
  </code>
</pre>

Expected Output

I expected all three code-blocks to have similar encapsulation similar to kramdown-1.17 so that the 3 code-blocks render with similar appearance at the front-end:

<div class="language-ruby highlighter-rouge">
  <div class="highlight">
    <pre class="highlight">
      <code>
        <span class="k">class</span> <span class="nc">Foo</span>
        <span class="k">def</span> <span class="nf">bar</span>
        <span class="nb">puts</span> <span class="s1">'Hello'</span>
        <span class="k">end</span>
        <span class="k">end</span>
      </code>
    </pre>
  </div>
</div>

<div class="language-text highlighter-rouge">
  <div class="highlight">
    <pre class="highlight">
      <code>
        class Foo
          def bar
            puts 'Hello'
          end
        end
      </code>
    </pre>
  </div>
</div>

<div class="highlighter-rouge">
  <div class="highlight">
    <pre class="highlight">
      <code>
        class Foo
          def bar
            puts 'Hello'
          end
        end
      </code>
    </pre>
  </div>
</div>

Summary

Since Rouge's plaintext lexer was voluntarily removed for kramdown-2.0, it would be helpful if there was an option to enable it according to a Document's use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment