Commit Graph

273 Commits

Author SHA1 Message Date
Estevao Soares dos Santos
084b819b14 feat(underline): add EXPERIMENTAL support for underline
Syntax is:
```
__double underscores__
or
___triple unserscores___
```
Keep in mind that, with this option enabled, underscore no longer
parses as `<em>` or `<strong>`

Closes #450
2017-10-24 16:46:40 +01:00
Estevao Soares dos Santos
9cdc35e705 feat(ol start num): add support for defining the first num of ol
Implement support for starting ordered lists at an arbitrary number

Closes #377
BREAKING CHANGE: Since showdown now supports starting ordered lists
at an arbitrary number, list output may differ.
2017-10-24 15:15:56 +01:00
Estevao Soares dos Santos
5b8f1d312f feat(emoji): add emoji support
Add unicode emoji support to showdown. To enable this feature,
use `emoji: true` option. A list of supported emojis is
available here: https://github.com/showdownjs/showdown/wiki/Emojis

Closes #448
2017-10-24 13:44:49 +01:00
Estevao Soares dos Santos
61929bb262 fix(autolinks): prevent _ and * to be parsed in links
Closes #444
2017-10-24 10:22:13 +01:00
Estevao Soares dos Santos
66bdd21312 fix(tables): trailing spaces no longer prevent table parsing
If there were a trailing space following the closing | of a single column
table, the table does not get rendered. This fixes the issue.

Closes #442
2017-10-06 12:52:20 +01:00
Estevao Soares dos Santos
d88b095f05 fix(tables): tables are properly rendered when followed by a single linebreak and a list
Closes #443
2017-10-06 12:38:01 +01:00
Estevao Soares dos Santos
3efcd101a2 fix(html-comments): changed regex to precent malformed long comment to freeze showdown
Closes #439
2017-10-02 05:18:10 +01:00
Estevao Soares dos Santos
8c593a4f11 feat(base64-wrapping): support for wrapping base64 strings
Wrapping base64 strings, which are usually extremely long lines of text, is now supported.
Newlines can be added arbitrarily, as long as they appear after the comma (,) character.

Closes #429
2017-09-08 20:46:01 +01:00
Estevao Soares dos Santos
ff26c08904 feat(rawPrefixHeaderId): add option to prevent showdown from modifying the prefix
Setting this option to true will prevent showdown from modifying the
prefix. This might result in malformed IDs (if, for instance, the " char is
used in the prefix). Has no effect if prefixHeaderId is set to false.

Closes #409
2017-08-06 18:19:46 +01:00
Estevao Soares dos Santos
1791cf0ebf feat(rawHeaderId): Remove only spaces, ' and " from generated header ids
This option removes only spaces, ' and " from generated Header IDs,
replacing them with dashes. This might generate malformed IDs.

Closes #409
2017-08-06 17:45:04 +01:00
Estevao Soares dos Santos
fef110cccb Fix(tables): allow for one column table
Closes #406
2017-08-05 03:34:49 +01:00
Estevao Soares dos Santos
8f05be7788 fix(literalMidWordAsterisks): fix option no longer treat punctuation as word character
Closes #398
2017-08-05 02:52:03 +01:00
Estevao Soares dos Santos
51e46933a4 fix(tablesHeaderId): fix missmatch of option name
In code, the option appeared both as 'tableHeaderId' and 'tablesHeaderId',
although only the first form had effect. In documentation was referenced
as 'tablesHeaderId'.
Option is now fixed in code to reflex the documentation and table parser
accepts both forms, with and without an s.

Closes #412
2017-08-04 20:19:15 +01:00
Estevao Soares dos Santos
a2259c063b fix(lists): fix multi paragraph lists with sublists
Paragraphed lists with sublists were being parsed incorrectly due to
workaround realted with simpleLineBreaks. This commit fixes this.

Closes #397
2017-06-07 03:33:20 +01:00
Estevao Soares dos Santos
5a5aff6721 feat(backslashEscapesHTMLTags): backslash escapes HTML tags
Add support for HTML tag escaping with backslash

Closes #374
2017-06-02 04:48:53 +01:00
Estevao Soares dos Santos
6566c72cc1 fix(HTML Parser): fix nasty bug where malformed HTML would hang showdown
When feeding malformed HTML to showdown, the library would enter an infinite loop,
effectively halting showdown's execution.

Closes #393
2017-06-02 03:29:29 +01:00
Marinin Tim
94c570a9d8 feat(customizeHeaderId): add option for customizing header ids
It’s useful for non-Latin texts, where header might be, for example, in Russian, but user wants id to be in English. This feature allows user to set id for header manually, using curly braces:

    ## Привет, мир {hello-world}

Closes #383
2017-06-01 02:35:42 +01:00
Estevao Soares dos Santos
30aa18c003 fix(url parsing): fix url edge case parsing in images and links
Allow some edge cases to parse correctly. Example:
`![img](.images/cat(1).png)`,
`![img](<.image(1)/cat(1).png>)`,
`[link](<>)`
2017-05-30 04:11:00 +01:00
Estevao Soares dos Santos
230f443442 test: add tests for issue #390 2017-05-28 17:30:18 +01:00
Estevao Soares dos Santos
6fbc072c2c fix(HTML parsing): fix HTML parsing issues with nested tags
Deeply nested HTML tags and recursive tags broke the HTML parser.

Closes #357, closes #387
2017-05-28 17:20:07 +01:00
Estevao Soares dos Santos
813f832160 fix(openLinksInNewWindow): encode _ to prevent clash with em
Closes #379
2017-04-25 22:13:27 +01:00
Estevao Soares dos Santos
71acff5757 fix(excludeTrailingPunctuationFromURLs): fix weird character when this option with simplifiedAutoLinks
Closes #378
2017-04-23 02:14:56 +01:00
Estevao Soares dos Santos
1bca88f8fa test: add several testcases 2017-04-23 02:04:13 +01:00
Estevao Soares dos Santos
f3dff7b0cf Merge branch 'master' into develop 2017-04-23 01:59:53 +01:00
Miguel Laginha
5bec8f9e9a feat(literalMidWordAsterisks): add option for mid word asterisks
Implements feature similar to ignoring midword underscores but with asterisks. The main use case is ignoring cursing.
2017-04-05 16:25:20 +01:00
Estevao Soares dos Santos
50235d6951 feat(openLinksInNewWindow): add option to open all links in a new window
Closes #362, #337, #249, #247, #222
2017-03-31 00:25:40 +01:00
Estevao Soares dos Santos
0c6c07b341 feat(images): add support for image's implicit reference syntax
Closes #366
2017-03-30 23:35:28 +01:00
Estevao Soares dos Santos
f1eab2a7f2 Merge branch 'master' into develop 2017-03-30 23:17:56 +01:00
simo
3e22fc658c Reset options before switching to a flavor (#365)
fix(flavors): reset options before switching to a flavor
2017-03-30 23:17:10 +01:00
Estevao Soares dos Santos
fa47938b81 blame: last commit introduced a bug 2017-03-15 02:49:20 +00:00
Estevao Soares dos Santos
fa35fd5e7e fix(excludeTrailingPunctuationFromURL): add comma to punctuation list
Closes #354
2017-03-09 00:43:45 +00:00
Estevão Soares dos Santos
c6ac36d9f2 test(appveyor): add appveyor testing
Add testing on windows environment
2017-03-05 05:08:52 +00:00
Estevão Soares dos Santos
93fecc8650 chore(travis): add support for node 0.12 in travis 2017-03-05 02:49:13 +00:00
Estevao Soares dos Santos
5c50675cca fix(simpleAutoLinks): URLs with emphasis/strikethrough are parsed
correctly

When a user enters a URL with emphasis or strikethrough, the html output
were incorrect.
Now, URLs inside emphasis or strikethrough are parsed corerctly

Closes #347
2017-02-26 19:13:52 +00:00
Estevao Soares dos Santos
1ebc1959dd fix(tables): pipe char can now be escaped
Pipe character is now treated as a special markdown char,
which makes it possible to escape it.

Closes #345
2017-02-21 14:13:12 +00:00
Estevao Soares dos Santos
605d8b7b05 fix(encodeEmail): now produces valid emails
Closes #340
2017-02-06 06:50:52 +00:00
Estevao Soares dos Santos
f641a7de90 fix(prefixHeaderId): make prefixHeaderId string be parsed along the generated id
If an invalid prefix was passed (a string with spaces, for instance),
the string would be added as is. This ould generate invalid ids.
Also, this makes `prefixHeaderId` option play nicely with `ghCompatibleHeaderId`, since they will
follow the same escaping rules when both options are enabled.
2017-02-06 05:37:49 +00:00
Estevao Soares dos Santos
41cb3f6b7f fix(hashCodeTags): escape code tags
Previously, `<code>` tags were not escaped. This was counter intuitive since ´<pre><code>` tags
were being escaped. Now both pre code and code are escaped.

Closes #339
2017-02-06 05:09:52 +00:00
Estevao Soares dos Santos
7f43b79b33 fix(encodeAmpsAndAngles): fix > and < encoding
In some circumstances, > and < were not being encoded properly.

Closes #236
2017-02-06 03:28:49 +00:00
greenkeeper[bot]
b5e46fdb8d Update dependencies to enable Greenkeeper 🌴 (#335)
adapt code to updated dependencies
2017-01-31 05:46:25 +00:00
Estevao Soares dos Santos
1832b7f721 fix(italicsAndBold): fix double emphasis edge case 2017-01-31 01:48:03 +00:00
Estevao Soares dos Santos
ab54933b16 release 1.6.3 2017-01-30 22:40:55 +00:00
Estevao Soares dos Santos
54bf74472a fix(paragraphs): fix empty lines generating empty paragraphs
Empty lines should not be parsed as paragraphs. This was happening
in determined circumstances.
For instance, when stripping reference style links, `\n\n` was left being,
creating an undesired empty paragraph. This commit fixes the issue.

Closes #334
2017-01-30 20:43:56 +00:00
Estevao Soares dos Santos
e18be38995 test: add test for simpleLineBreak and pre tags 2017-01-30 18:11:13 +00:00
Estevao Soares dos Santos
dbbee6c094 test: add test for literalMidWordUnderscores 2017-01-30 00:04:16 +00:00
Estevao Soares dos Santos
94c9700d1a test: add test for emphasis case 2017-01-30 00:01:57 +00:00
Estevao Soares dos Santos
0292ae0dcb fix(literalMidWordUnderscores): Inconsistent behavior of emphasis and strong with literalMidWordUndescores
Closes #333
2017-01-29 23:31:52 +00:00
Estevao Soares dos Santos
a4f05d4693 fix(italicsAndBold): fiz inconsistency in italicsAndBold parsing
The way showdown parsed cases suchs as this:
```
**foo **bar
__foo __bar
*foo *bar
_foo _bar
```
was inconsistent. This established that `__` or `**` preceeding a word
would not be parsed as em or strong.

Closes #332
2017-01-29 23:24:31 +00:00
Estevao Soares dos Santos
e4c43ea433 refactor(italicsAndBold): refactoring of italicsAndBold regexes for speed 2017-01-29 22:29:21 +00:00
Estevao Soares dos Santos
169cbe8e2d fix(strikethrough): fix striketrough being wrongly parsed inside codeSpans 2017-01-29 19:38:45 +00:00
Estevao Soares dos Santos
7d63a3e635 feat(events): add events to all subparsers
This commit adds events to all subparsers (that were previously not being watched).
2017-01-29 19:28:30 +00:00
Estevao Soares dos Santos
51cc7c430f test: add some strikethrough tests 2017-01-29 00:26:29 +00:00
Estevao Soares dos Santos
24d47d7c68 fix(strikethrough): allow escapinging tilde char
Since tilde is now used as a magic markdown character,
in strikethrough syntax, we need to enable escaping it.

Closes #331
2017-01-28 23:54:28 +00:00
Estevao Soares dos Santos
a4c24c9805 feat(ghMentionsLink): add ability to define the generated url in @mentions
This option enables users to define the generated links in @mentions.
For instance,  with ghMentionsOption set to `//mysite.com/{u}/profile`
this text
`@tivie`
will result in this link
`<a href="//mysite.com/tivie/profile">@tivie</a>`
2017-01-28 04:28:50 +00:00
Estevao Soares dos Santos
dbf876b6cb test: add test for nested gh codeblocks 2017-01-28 03:59:27 +00:00
Estevao Soares dos Santos
ed6a687013 bump package.json 2017-01-28 02:53:25 +00:00
Estevao Soares dos Santos
0c9ebd4e24 refactor: some minor performance improvements 2017-01-28 02:46:34 +00:00
Estevao Soares dos Santos
4613260cdf refactor: create horizontal rules own subParser 2017-01-28 02:17:19 +00:00
Estevao Soares dos Santos
ef7d0ec7a9 test: use new performance test file 2017-01-28 02:04:50 +00:00
Estevao Soares dos Santos
4b53d3707b test: add newline at end of test files 2017-01-28 01:46:33 +00:00
Estevao Soares dos Santos
d3ebbc128e chore: add newline at end of test files 2017-01-28 01:34:38 +00:00
Estevao Soares dos Santos
fea64bdd3c test: add tests for helper functions
Closes #167
2017-01-28 01:19:07 +00:00
Estevao Soares dos Santos
32a4cee258 chore: update chai 2017-01-27 22:07:55 +00:00
Estevao Soares dos Santos
0b32a95efd chore(performance): update performance testing 2017-01-27 20:53:47 +00:00
Estevao Soares dos Santos
5190b6a41f fix(simplifiedAutoLink): fix missing spaces before and after email addresses
Space char before and after the linked email address is no longer dropped
with "simplifiedAutoLink" option enabled.

Closes #330
2017-01-27 19:25:46 +00:00
Estevao Soares dos Santos
90c52b83e7 feat(encodeEmail): add option to enable/disable mail obfuscation
Prior to version 1.6.1, emails would always be obfuscated through dec and hex encoding.
This option makes it possible to disable this.
2017-01-27 19:03:37 +00:00
Estevao Soares dos Santos
b6513fadb9 release 1.6.0 2017-01-09 02:38:24 +00:00
Estevao Soares dos Santos
f3b86f06cc feat(CLI): add -q (quiet) and -m (mute) mode to CLI
-q supresses all normal messages from the output, but still reports errors.
-m mutes all messages, even errors.
2017-01-09 02:26:24 +00:00
Estevao Soares dos Santos
e3521bd8fa refactor(CLI): refactoring of CLI code 2017-01-09 02:08:23 +00:00
Estevao Soares dos Santos
0eaf1050c7 feat(getFlavor): add getFlavor method to showdown and Converter
With this new method, you can check what type of base flavor showdown is currently set
to run as.
2017-01-08 19:09:12 +00:00
Estevao Soares dos Santos
a58674e597 chore: improve ghMentions 2017-01-06 04:58:28 +00:00
Estevao Soares dos Santos
f2671c0cc7 feat(ghMentions): add support for github's @mentions
Closes #51
2017-01-06 04:33:12 +00:00
Estevao Soares dos Santos
b1c458a762 fix(simpleLineBreaks): fix simpleLineBreaks option not working with non-ASCII chars and markdown delimiters
The option simpleLineBreaks was not working with non-ASCII characters such as chinese characters and
when lines started or ended with markdown delimiters such as `*` or `~`

Closes #318, #323
2017-01-06 03:51:12 +00:00
Estevao Soares dos Santos
d499feb2aa fix(ghCompatibleHeaderId): improve the number of removed chars 2016-12-30 19:46:46 +00:00
Estevao Soares dos Santos
db97a90d5b feat(ghCompatibleHeaderId): generate header ids compatible with github
style

Github replaces spaces with dashes and removes a bunch of characters
from generated header ids ][&~$!@#*()=:/,;?+'.\
This feature implements this.

Closes # 320, closes #321
2016-12-30 19:01:44 +00:00
Estevao Soares dos Santos
bba9722ad4 test: add more performance tests 2016-12-23 10:07:14 +00:00
Estevao Soares dos Santos
43ff0b643e test: add performance tests 2016-12-23 09:29:58 +00:00
Estevao Soares dos Santos
ed4c33fe4e fix(simpleLineBreaks): fix simpleLineBreak option breaking lists html
When option was enabled, `<br />` tags where being added wrongfully
between `<li>` tags, which resulted in malformed html. This commit
prevents this behavior.

Closes #316
2016-12-20 23:57:10 +00:00
Estevao Soares dos Santos
113f5f64b1 fix(horizontal rule): revert backwards incompatibility change
Horizontal rule syntax allows up to 3 spaces preceding dashes or
asterisks. Commit da8fb53 wrongfully removed that. This commit
puts that back.

Closes #317
2016-12-20 22:08:33 +00:00
Estevao Soares dos Santos
d532dea8f0 Merge branch 'master' into develop 2016-12-19 12:16:22 +00:00
Estevao Soares dos Santos
da8fb535c9 fix: parser slowness with certain inputs
A bad desinged regex was causing the parser to become extremelly slow
when given some inputs.

Closes #315
2016-12-19 12:13:30 +00:00
Estevao Soares dos Santos
5d19877590 feat(requireSpaceBeforeHeadingText): option to make space between # and header text mandatory
Credit: @nikz [Nik Wakelin](https://github.com/nikz)

Closes #277
2016-12-17 06:01:15 +00:00
Estevao Soares dos Santos
10b3410934 fix: lines with mutiple dashes being parsed as multilists
This input: `- - - a` causes trouble for the parser,
since it interprets it as multiple sublists, where it should
only interpert it as a list with a single list item.
This commit fixes this behavior.

Closes #312
2016-12-17 05:20:23 +00:00
Estevao Soares dos Santos
d2fc2a0c5c feature(excludeTrailingPunctuationFromURLs): excludes trailing punctuation from auto linked URLs
Closes #266, #308
2016-12-01 15:25:46 +00:00
Estevao Soares dos Santos
0942b5e87d feature(simpleLineBreaks): parse linebreaks as <br />
This option enables linebreaks to always be treated as `<br />` tags
without needing to add spaces in front of the line, the same way GitHub does.

Closes #206
2016-11-30 18:04:17 +00:00
Estevao Soares dos Santos
0be39bccae feat(disableForced4SpacesIndentedSublists): option that disables the requirement of indenting nested sublists by 4 spaces 2016-11-11 08:15:24 +00:00
Estevao Soares dos Santos
d51be6e0b4 fix(lists): enforce 4 space indentation in sublists
Acording to the spec, multi paragraph (or block) list item requires subblocks
to be indented 4 spaces (or 1 tab). Although, this is mentioned in the documentation,
Showdown didn't enforce this rule in sublists because other implementations,
such as GFM also didn't. However, in some edge cases, this led to inconsistent behavior,
as shown in issue #299. This commit makes 4 space indentation in sublists
mandatory.

BREAKING CHANGE: syntax for sublists is more restrictive. Before, sublists SHOULD be
indented by 4 spaces, but indenting 2 spaces would work. Now, sublists MUST be
indented 4 spaces or they won't work.

With this input:
```md
* one
  * two
    * three
```

Before (ouput):
```html
<ul>
  <li>one
    <ul>
      <li>two
        <ul><li>three</li></ul>
      <li>
    </ul>
  </li>
<ul>
```

After (output):
```html
<ul>
  <li>one</li>
  <li>two
    <ul><li>three</li></ul>
  </li>
</ul>
```

To migrate either fix source md files or activate the option `disableForced4SpacesIndentedSublists` (coming in v1.5.0):

```md
showdown.setOption('disableForced4SpacesIndentedSublists', true);
```
2016-11-11 07:56:29 +00:00
Estevao Soares dos Santos
9cfe8b1412 fix(lists): fix sublists inconsistent behavior
Nested ul and ol lists behave inconsistently in the requirement
of having 3 spaces to be considered a nested list.
This fix changes the requirement to only one space in
both cases.

Closes #299
2016-11-09 02:54:18 +00:00
Estevao Soares dos Santos
2b813cd3fb fix(lists linebreaks): fix lists linebreaks in html output
Closes #291
2016-09-29 01:12:27 +01:00
Estevao Soares dos Santos
f97e072bc4 fix(double linebreaks): fix double linebreaks in html output
Closes #291
2016-09-29 00:50:58 +01:00
Estevao Soares dos Santos
799abea767 fix(parser): fix issue with comments inside nested code blocks
Code blocks containing comments are now converted correctly when nested in list items.

Closes #288
2016-08-30 06:07:57 +01:00
Estevao Soares dos Santos
0cc55b07ee fix(simplifiedAutoLink): fix simplified autolink to match GFM behavior
Using the simplifiedAutoLink option does not return the expected GFM behaviour when parsing links without a http prefix.
Previously, `www.google.com` would be parsed into `<a href="www.google.com">www.google.com</a>`.
With this fix, showdown behaves like GFM, and the result is `<a href="http://www.google.com">www.google.com</a>`

Closes #284, closes #285
2016-08-19 19:12:25 +01:00
Estevao Soares dos Santos
8591ec8196 Merge branch 'develop' into feature/source_indentation_auto_removal 2016-06-21 01:42:50 +01:00
Estevão Soares dos Santos
73206b07fb fix(image-parser): fix ref style imgs after inline style imgs not parsing correctly
When reference style and inline style are mixed together, in the same line, it produces weird parsing bugs. This commit fixes this

Closes #261
2016-06-08 17:16:49 +01:00
Estevão Soares dos Santos
261f127f7e feat(smart-indent-fix): fix for es6 identation problems
Closes #259
2016-06-07 01:23:52 +01:00
Stewart McKee
6e30a48890 added check for undefined on text due to failing to parse tables 2016-05-24 10:26:59 +01:00
Estevão Soares dos Santos
ddaacfc41a fix(tables): fix table heading separators requiring 3 dashes instead of 2
Closes #256
2016-05-17 21:27:40 +01:00
Estevão Soares dos Santos
6e5073d977 chore: remove html beautify from tests 2016-02-02 00:29:06 +00:00
Estevão Soares dos Santos
6412eadf29 fix weird travis issue try 1 2016-02-01 03:56:22 +00:00
Estevão Soares dos Santos
f58f014bc3 fix(tables): fix tables to match github's md spec
Now Leading and trailing pipes (|) are optional in tables

Closes #230
2016-01-25 05:24:54 +00:00