Giter VIP home page Giter VIP logo

Comments (4)

nunof07 avatar nunof07 commented on May 31, 2024

Hi @auxtern , thanks.

I have no idea. Try it and let me know!

from markdown-it-fontawesome.

auxtern avatar auxtern commented on May 31, 2024

I've tried it.

the problem arose for importing the Regex plugin, which states "require is not defined". It's a bit confusing to get around this.

(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.markdownitFontAwesome = factory());
  })(this, (function () { 
    
    'use strict';

    var Plugin = require('markdown-it-regexp');

    module.exports = function fontawesome_plugin(md) {
        // FA4 style.
        md.use(Plugin(
            /\:fa-([\w\-]+)\:/,
            function (match, utils) {
                return '<i class="fa fa-' + utils.escape(match[1]) + '"></i>';
            }
        ));

        // FA5 style.
        md.use(Plugin(
            /\:fa([\w])-([\w\-]+)\:/,
            function (match, utils) {
                return '<i class="fa' + utils.escape(match[1]) + ' fa-' + utils.escape(match[2]) + '"></i>';
            }
        ));
    };

}));

from markdown-it-fontawesome.

auxtern avatar auxtern commented on May 31, 2024

For reference I looked at the markdown-it-emoji plugin:
https://github.com/markdown-it/markdown-it-emoji/blob/master/dist/markdown-it-emoji.js

from markdown-it-fontawesome.

nunof07 avatar nunof07 commented on May 31, 2024

Yeah, it wasn't built with this in mind.

This plugin is pretty small. If you can get markdown-it-regexp to work on the browser, it should be easy to just copy the code from this plugin and apply in your project.

Or if you are passing this package through a bundler, maybe there is a way to make it work.

from markdown-it-fontawesome.

Related Issues (4)

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.