Explorar o código

optional heading params

Ivan Asmer %!s(int64=4) %!d(string=hai) anos
pai
achega
ef12970654
Modificáronse 1 ficheiros con 6 adicións e 6 borrados
  1. 6 6
      index.mjs

+ 6 - 6
index.mjs

@@ -191,7 +191,7 @@ const syntax = {
     heading6: {
         paired: true,
         recursive: true,
-        startRegexp: /\n######[ \t]*(.*)\n/,
+        startRegexp: /\n######[ \t]*([^\[]*)(\[#(\S*)[ \t]*(.*)\])?\n/,
         endRegexp: /\n#\s/,
         content: {
             start: {
@@ -219,7 +219,7 @@ const syntax = {
     heading5: {
         paired: true,
         recursive: true,
-        startRegexp: /\n#####[ \t]*(.*)\n/,
+        startRegexp: /\n#####[ \t]*([^\[]*)(\[#(\S*)[ \t]*(.*)\])?\n/,
         endRegexp: /\n#{1,5}\s/,
         content: {
             start: {
@@ -248,7 +248,7 @@ const syntax = {
     heading4: {
         paired: true,
         recursive: true,
-        startRegexp: /\n####[ \t]*(.*)\n/,
+        startRegexp: /\n####[ \t]*([^\[]*)(\[#(\S*)[ \t]*(.*)\])?\n/,
         endRegexp: /\n#{1,4}\s/,
         content: {
             start: {
@@ -277,7 +277,7 @@ const syntax = {
     heading3: {
         paired: true,
         recursive: true,
-        startRegexp: /\n###[ \t]*(.*)\n/,
+        startRegexp: /\n###[ \t]*([^\[]*)(\[#(\S*)[ \t]*(.*)\])?\n/,
         endRegexp: /\n#{1,3}\s/,
         content: {
             start: {
@@ -306,7 +306,7 @@ const syntax = {
     heading2: {
         paired: true,
         recursive: true,
-        startRegexp: /\n##[ \t]*(.*)\n/,
+        startRegexp: /\n##[ \t]*([^\[]*)(\[#(\S*)[ \t]*(.*)\])?\n/,
         endRegexp: /\n#{1,2}\s/,
         content: {
             start: {
@@ -335,7 +335,7 @@ const syntax = {
     heading1: {
         paired: true,
         recursive: true,
-        startRegexp: /\n#[ \t]*(.*)\n/,
+        startRegexp: /\n#[ \t]*([^\[]*)(\[#(\S*)[ \t]*(.*)\])?\n/,
         endRegexp: /\n#\s/,
         content: {
             start: {