markdown-it-emphasis-alt
Version:
tag for markdown-it markdown parser.
3 lines (2 loc) • 2.22 kB
JavaScript
/*! markdown-it-emphasis-alt 1.0.8 https://github.com/jay-hodgson/markdown-it-emphasis-alt @license MIT */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.markdownitEmphasisAlt=e()}}(function(){return function e(r,n,t){function o(s,f){if(!n[s]){if(!r[s]){var a="function"==typeof require&&require;if(!f&&a)return a(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=n[s]={exports:{}};r[s][0].call(p.exports,function(e){var n=r[s][1][e];return o(n?n:e)},p,p.exports,e,r,n,t)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<t.length;s++)o(t[s]);return o}({1:[function(e,r,n){"use strict";function t(e,r){s=!1,f=!1,a=r?r:0,u=e}function o(e,r){var n,o,i,p=e.pos,d=e.src.charCodeAt(p),l=!1,m=p;if(r)return!1;if(95!==d&&42!==d)return!1;if(o=p>0?String.fromCharCode(e.src.charCodeAt(p-1)):" ",i=e.pos+1<e.posMax?String.fromCharCode(e.src.charCodeAt(e.pos+1)):" ",95===d&&c.test(o)&&c.test(i))return!1;for(p+1<=e.posMax&&e.src.charCodeAt(p+1)===d&&(l=!0);m<e.posMax&&"\n"!==e.src.charAt(m);)m++;return(e.src!==u||m>a)&&t(e.src,m),n=e.push("text","",0),n.content=String.fromCharCode(d),l?(f=!f,n.content+=String.fromCharCode(d)):s=!s,e.delimiters.push({marker:d,jump:0,token:e.tokens.length-1,level:e.level,end:-1,open:l?f:s,close:l?!f:!s,isDoubleMarker:l}),e.pos++,l&&e.pos++,!0}function i(e){var r,n,t,o,i,s,f=e.delimiters,a=e.delimiters.length;for(r=0;a>r;r++)n=f[r],95!==n.marker&&42!==n.marker||-1!==n.end&&(t=f[n.end],s=n.isDoubleMarker,i=String.fromCharCode(n.marker),o=e.tokens[n.token],o.type=s?"strong_open":"em_open",o.tag=s?"strong":"em",o.nesting=1,o.markup=s?i+i:i,o.content="",o=e.tokens[t.token],o.type=s?"strong_close":"em_close",o.tag=s?"strong":"em",o.nesting=-1,o.markup=s?i+i:i,o.content="")}var s,f,a,u,p=!1,c=/[a-zA-Z0-9]/;r.exports=function(e){t(0),p||(e.disable("emphasis"),e.inline.ruler.before("emphasis","emphasis_alt",o),e.inline.ruler2.before("emphasis","emphasis_alt",i),p=!0)}},{}]},{},[1])(1)});