Giter Site home page Giter Site logo

Comments (3)

pulges avatar pulges commented on July 29, 2024

Adding class with formatBlock is already built in but was not documented.
Added it in documentation.
https://github.com/Edicy/wysihtml5/wiki/Supported-Commands#wiki-formatBlock

I will have to do some research about the 'code' tag suggestion, as by specification "code" tag is not a block-level element. It would help if You could argument your case or explain your use-case.

from wysihtml.

brunobg avatar brunobg commented on July 29, 2024

Ok, you get a point. So let me explain what I want. I want to let users to paste code in the editor. Ideally it should generate a <pre class="someclass"><code></code></pre> tag for code blocks. This seems a bit complicated, which is why I thought about adding <code> to BLOCK_ELEMENTS_GROUP.
But I'd settle for any other solution to this problem. Thanks!

from wysihtml.

pulges avatar pulges commented on July 29, 2024

I made a special command to cover the issue "formatCode"
765fe73

Generates code:

<pre><code class="language-html"></code></pre>

Usage with native toolbar ():

<a data-wysihtml5-command="formatCode" data-wysihtml5-command-value="language-html">Code</a>

or from javascript:

editorInstance.composer.commands.exec("formatCode", "language-html");

from wysihtml.

Related Issues (20)

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.