mirror of
https://github.com/lucaspalomodevelop/txtmark.git
synced 2026-03-13 07:39:37 +00:00
Merge pull request #16 from thradec/fenced-code-block-delimited-by-tilde
Fenced code block delimited by tilde ~ characters
This commit is contained in:
commit
99e83e6ee5
@ -773,6 +773,7 @@ class Emitter
|
||||
case '_':
|
||||
case '!':
|
||||
case '`':
|
||||
case '~':
|
||||
case '^':
|
||||
return MarkToken.ESCAPE;
|
||||
default:
|
||||
|
||||
@ -138,6 +138,7 @@ class Line
|
||||
case '_':
|
||||
case '!':
|
||||
case '`':
|
||||
case '~':
|
||||
sb.append(c);
|
||||
pos++;
|
||||
break;
|
||||
@ -263,9 +264,11 @@ class Line
|
||||
|
||||
if(extendedMode)
|
||||
{
|
||||
if(this.value.length() - this.leading - this.trailing > 2 && this.value.charAt(this.leading) == '`')
|
||||
if(this.value.length() - this.leading - this.trailing > 2)
|
||||
{
|
||||
if(this.countCharsStart('`') >= 3)
|
||||
if(this.value.charAt(this.leading) == '`' && this.countCharsStart('`') >= 3)
|
||||
return LineType.FENCED_CODE;
|
||||
if(this.value.charAt(this.leading) == '~' && this.countCharsStart('~') >= 3)
|
||||
return LineType.FENCED_CODE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -639,11 +639,11 @@ class Utils
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes trailing <code>`</code> and trims spaces.
|
||||
* Removes trailing <code>`</code> or <code>~</code> and trims spaces.
|
||||
*
|
||||
* @param fenceLine
|
||||
* Fenced code block starting line
|
||||
* @return Rest of the line after trimming and backtick removal
|
||||
* @return Rest of the line after trimming and backtick or tilde removal
|
||||
* @since 0.7
|
||||
*/
|
||||
public final static String getMetaFromFence(String fenceLine)
|
||||
@ -651,7 +651,7 @@ class Utils
|
||||
for(int i = 0; i < fenceLine.length(); i++)
|
||||
{
|
||||
final char c = fenceLine.charAt(i);
|
||||
if(!Character.isWhitespace(c) && c != '`')
|
||||
if(!Character.isWhitespace(c) && c != '`' && c != '~' )
|
||||
{
|
||||
return fenceLine.substring(i).trim();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user