Skip to content

Commit 74ac946

Browse files
committed
Initial deploy
1 parent ba32a02 commit 74ac946

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1913
-2
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ typings/
8080

8181
# Nuxt.js build / generate output
8282
.nuxt
83-
dist
8483

8584
# Gatsby files
8685
.cache/
@@ -102,3 +101,6 @@ dist
102101

103102
# TernJS port file
104103
.tern-port
104+
105+
######## JETBRAINS
106+
/.idea

CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
showdownjs.com

android-chrome-192x192.png

4.63 KB
Loading

android-chrome-512x512.png

5.43 KB
Loading

apple-touch-icon.png

4.87 KB
Loading

blog/annoucement-showdown-2.0.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
«««
2+
title: Annoucement: Showdown 2.0,
3+
author: Estevão Soares dos Santos,
4+
author_avatar: img/avatars/tivie.jpg,
5+
date: 2017-12-12,
6+
language: en,
7+
image: img/blog/2017.12.12.jpg,
8+
summary: Showdown version 1.0.0 was released almost 3 years ago, back in May 2015.
9+
Since then, it has seen a lot of improvements, with a boost to performance and a significant number of features now
10+
included in the core of the library. However, do to backwards compatibility constrains, we are still supporting a
11+
lot of legacy features, that prevent us from moving the software forward.
12+
With that in mind, **it is time to start thinking about Showdown version 2.0.**
13+
For the next major release of Showdown we have planned a range of **significant changes and additions**.
14+
»»»
15+
Showdown version 1.0.0 was released almost 3 years ago, back in May 2015.
16+
Since then, it has seen a lot of improvements, with a boost to performance and
17+
a significant number of features now included in the core of the library.
18+
19+
However, do to backwards compatibility constrains, we are still supporting a lot
20+
of legacy features, that prevent us from moving the software forward.
21+
22+
With that in mind, **it is time to start thinking about Showdown version 2.0.**
23+
24+
For the next major release of Showdown we have planned a range of **significant changes
25+
and additions**. Here are a few of the most important ones:
26+
27+
## Reverse Conversion (HTML to MD)
28+
29+
Being a popular request by our users, we though that a new major version is the perfect
30+
opportunity to implement this feature.
31+
32+
This feature requires a number of changes throughout the code and API. For instance,
33+
the extension system must be redesigned to allow for extensions to hook unto both
34+
processes (HTML->MD and MD->HTML). Event and option names must also reflect this
35+
since, as they stand now, they might cause confusion.
36+
37+
## Extensions
38+
39+
We are (finally) **completely dropping support for legacy extensions**. Although there are a
40+
couple old ones still in the wild, most of them (if not all) have already
41+
migrated to the modern extension system.
42+
43+
We are also revamping the extension system. For starters, **we're dropping old "lang"
44+
and "output" extension in favour of event extensions**.
45+
46+
The **API of event extensions will also change** in order to mimic the browser events
47+
and play nicely with other libraries and frameworks.
48+
49+
## Subparsers
50+
51+
**Subparsers will also see a major code refactoring**, with performance improvements.
52+
Although performance is no longer an issue, mainly due to the way new browsers
53+
handle Regular Expressions, there are a couple of issues that still need to be addressed.
54+
Most of the issues can be fixed if we drop support for old browsers and old nodejs versions.
55+
56+
## Development
57+
58+
Formally, Showdown 2.0 will start development in the beginning of 2018 and all
59+
development efforts will be put into it.
60+
This means **Showdown 1.x will now enter maintenance mode, that is, no new features
61+
will be added** and only important bugfixes will be committed.
62+
63+
We expect to release an alpha version of Showdown 2.0 somewhere around ~~August 2018,~~
64+
the fall of 2018. ***So, if you are as excited as we are, stay tuned for more information***.

blog/img/2017.12.12.jpg

127 KB
Loading

blog/img/2018.09.25.jpg

18.1 KB
Loading

blog/img/2018.10.16.jpg

157 KB
Loading

blog/img/2018.11.03.jpg

313 KB
Loading

blog/patreon-launch.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
«««
2+
title: We Just Launched Patreon!,
3+
author: Estevão Soares dos Santos,
4+
author_avatar: img/avatars/tivie.jpg,
5+
date: 2018-11-03,
6+
language: en,
7+
image: img/blog/2018.11.03.jpg,
8+
summary: I'm very happy to say that Patreon is Up! Check out the cool rewards I have planned for you. And there is also a surprise announcement regarding a new release...
9+
»»»
10+
11+
I am very proud to announce the launch of [Showdown's Patreon page!][patreon]
12+
13+
This allows you to support me as a developer and make a better future for this library.
14+
15+
Please check out the very very cool rewards I planned for you and/or your company!
16+
17+
Also, [if I have 10 pledges by the end of the weekend][pledges], I will launch version 1.9 with some awesome new features by the end of next week...otherwise I will hold it hostage till next year!
18+
19+
Nah just kidding, I will launch it by then anyway.
20+
21+
# What's planned for version 1.9
22+
23+
While I'm working on version 2.0 ([which is a major refactor of Showdown][1]), I though it would be nice to publish a new minor version of showdown, with some of the features (as experimental features) already developed for version 2.0. This way you can start experimenting with it and tell me what you think.
24+
25+
The most exciting (and requested) new feature, IMHO, is the **"HTML to Markdown Converter"**. This neat feature will enable you to parse and convert an HTML document into markdown.
26+
27+
I will also backport some pending bugfixes too.
28+
29+
So, stay tunned and... don't forget to donate! :grin:
30+
31+
32+
33+
34+
[patreon]: https://www.patreon.com/showdownjs
35+
[pledges]: https://www.patreon.com/bePatron?u=11141581
36+
[1]: http://showdownjs.com/#!/blog/rewriting-the-parser-challenges-and-opportunities

blog/posts.json

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[
2+
{
3+
"id": 1,
4+
"canonical": "annoucement-showdown-2.0",
5+
"url": "blog/annoucement-showdown-2.0.md",
6+
"metadata": {
7+
"title": "Annoucement: Showdown 2.0",
8+
"author": "Estevão Soares dos Santos",
9+
"author_avatar": "img/avatars/tivie.jpg",
10+
"date": "2017-12-12",
11+
"language": "en",
12+
"image": "blog/img/2017.12.12.jpg",
13+
"summary": "Showdown version 1.0.0 was released almost 3 years ago, back in May 2015. Since then, it has seen a lot of improvements, with a boost to performance and a significant number of features now included in the core of the library. However, do to backwards compatibility constrains, we are still supporting a lot of legacy features, that prevent us from moving the software forward.\n\nWith that in mind, **it is time to start thinking about Showdown version 2.0.** For the next major release of Showdown we have planned a range of **significant changes and additions**."
14+
}
15+
},
16+
{
17+
"id": 2,
18+
"canonical": "rewriting-the-parser-challenges-and-opportunities",
19+
"url": "blog/rewriting-the-parser-challenges-and-opportunities.md",
20+
"metadata": {
21+
"title": "Rewriting the parser: Challenges and opportunities",
22+
"author": "Estevão Soares dos Santos",
23+
"author_avatar": "img/avatars/tivie.jpg",
24+
"date": "2018-09-25",
25+
"language": "en",
26+
"image": "blog/img/2018.09.25.jpg",
27+
"summary": "There comes a time when tough (and exciting) choices need to be made. With a version 2.0 in the oven (and the exciting reverse parser already completed), it seemed an excellent opportunity for doing something that I wished for a long time: rewriting showdown's parser from scratch. But maybe that challenge was a lot more tough than I first anticipated!"
28+
}
29+
},
30+
{
31+
"id": 3,
32+
"canonical": "showdown-1.8.7-released",
33+
"url": "blog/showdown-1.8.7-released.md",
34+
"metadata": {
35+
"title": "Showdown 1.8.7 released",
36+
"author": "Estevão Soares dos Santos",
37+
"author_avatar": "img/avatars/tivie.jpg",
38+
"date": "2018-10-16",
39+
"language": "en",
40+
"image": "blog/img/2018.10.16.jpg",
41+
"summary": "While everyone's waiting for the new Showdown 2.0, we released version 1.8.7 with some improvements and several bugfixes"
42+
}
43+
},
44+
{
45+
"id": 4,
46+
"canonical": "patreon-launch",
47+
"url": "blog/patreon-launch.md",
48+
"metadata": {
49+
"title": "We Just Launched Patreon!",
50+
"author": "Estevão Soares dos Santos",
51+
"author_avatar": "img/avatars/tivie.jpg",
52+
"date": "2018-11-03",
53+
"language": "en",
54+
"image": "blog/img/2018.11.03.jpg",
55+
"summary": "I'm very happy to say that Patreon is Up! Check out the cool rewards I have planned for you. And there is also a surprise announcement regarding a new release..."
56+
}
57+
},
58+
{
59+
"id": 5,
60+
"canonical": "showdown-1.9.0-released",
61+
"url": "blog/showdown-1.9.0-released.md",
62+
"metadata": {
63+
"title": "Showdown 1.9.0 Released",
64+
"author": "Estevão Soares dos Santos",
65+
"author_avatar": "img/avatars/tivie.jpg",
66+
"date": "2018-11-10",
67+
"language": "en",
68+
"image": "blog/img/2018.10.16.jpg",
69+
"summary": "We are very happy to announce the release of version 1.9.0, with a new and exciting feature: the Markdown to HTML converter!"
70+
}
71+
}
72+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
«««
2+
title: Rewriting the parser: Challenges and opportunities,
3+
author: Estevão Soares dos Santos,
4+
author_avatar: img/avatars/tivie.jpg,
5+
date: 2018-09-25,
6+
language: en,
7+
image: img/blog/2018.09.25.jpg,
8+
summary: There comes a time when tough (and exciting) choices need to be made. With a version 2.0 in the oven
9+
(and the exciting reverse parser already completed), it seemed an excellent opportunity for doing something
10+
that I wished for a long time: rewriting showdown's parser from scratch. But maybe that challenge was a lot
11+
more tough than I first anticipated!
12+
»»»
13+
14+
***There comes a time when tough (and exciting) choices need to be made. With a version 2.0 in the oven
15+
(and the exciting reverse parser already completed), it seemed an excellent opportunity for doing something that
16+
I wished for a long time: rewriting showdown's parser from scratch.***
17+
18+
But maybe that challenge was a lot more tough than I first anticipated!
19+
20+
## The old parser
21+
22+
The old parser was based on replacing markdown text *in loco* and in the original string with HTML, through a series of
23+
Regular Expression.
24+
While this was true to showdown's origins in John Gruber's Markdown.pl, during the last 3 years it became clear that
25+
Regex, at least by itself, was not suitable for the parsing job.
26+
27+
Don't get me wrong, Regex is a great tool: *not only does it works for 99% of use cases*, it also makes it extremely easy
28+
to develop extensions that complement showdown's features, even for beginner programmers.
29+
30+
The problem, however, are those pesky edge cases... that 1% of weird scenarios that ended up making showdown's Regular Expressions
31+
increasingly complex over time
32+
33+
In fact, when you compare v 1.0 to v. 1.8.6, it's plain to see that almost all bug fixes (with notable exceptions)
34+
were, in fact, edge case fixes.
35+
36+
## Regex Madness
37+
38+
Some regexes grew so weirdly that I ended up needing to split them in chunks and do some convoluted stuff to keep them minimally sane.
39+
For instance, it takes 6 RegExps just to parse `__foo__bar__baz__`.
40+
```javascript
41+
if (options.literalMidWordUnderscores) {
42+
text = text.replace(/\b___(\S[\s\S]*)___\b/g, function (wm, txt) {
43+
return parseInside (txt, '<strong><em>', '</em></strong>');
44+
});
45+
text = text.replace(/\b__(\S[\s\S]*)__\b/g, function (wm, txt) {
46+
return parseInside (txt, '<strong>', '</strong>');
47+
});
48+
text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
49+
return parseInside (txt, '<em>', '</em>');
50+
});
51+
} else {
52+
text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
53+
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
54+
});
55+
text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
56+
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
57+
});
58+
text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
59+
// !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
60+
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
61+
});
62+
}
63+
```
64+
65+
Others, which were inherited from when I took over the project, were just plainly poorly coded and
66+
[hid some nasty bugs within](https://codereview.stackexchange.com/questions/150277/regex-to-parse-horizontal-rules-in-markdown).
67+
68+
Javascript's regex limitations (such as no support for Lookbehind or atomic and possessive grouping) meant that I needed to rely
69+
on the language's quirks and look for hacks to overcome those limitations.
70+
At some point I even had to adapt a [recursive RegExp extension](https://github.com/showdownjs/showdown/blob/version_1.x/src/helpers.js#L210)
71+
which seems an overkill for a syntax that doesn't really care about balanced stuff.
72+
73+
And some stuff was just []impossible to fix](https://github.com/showdownjs/showdown/issues/549) without making the parser
74+
very VERY slow for everyone.
75+
76+
77+
## Enter the new parser
78+
79+
For all those reasons, and some more, I felt that version 2.0 should have a shinny and **proper new parser** that read
80+
the code sequentially and was aware of context (use more code logic and less RexExp wizardry :tada:). The new parser is,
81+
in fact, a lot more similar to a PEG parser than a RegExp converter with in place substitutions.
82+
83+
Some key features include:
84+
85+
- **Sequential**
86+
87+
The new parser reads the input sequentially. When a syntax element match is found, it "stores" the element without
88+
changing the original string. This means that Showdown no longer relies on (nor needs) a specific order in which
89+
sub parsers are invoked.
90+
91+
- **Full separation of the *parsing* and *conversion* steps**
92+
93+
Instead of making in place substitutions of the original input, the new parser creates an intermediary abstract layer,
94+
an object that is a *node tree* of elements, similar to the DOM Tree in the browser, which makes it easy to manipulate
95+
each node before outputting it as a string again, in other format.
96+
97+
98+
- **Output manipulation is extremely easy and customizable through templates**
99+
100+
The node tree (and each individual node) can be manipulated as you see fit since it's, in practice, an agnostic
101+
representation of an element. Each node has a template for each supported format: HTML and Markdown. But you can
102+
even add more formats if you wish.
103+
104+
What is cool is that, **not only can you can manipulate the tree (add, delete or swap nodes)**, you can also **tweak
105+
or completely change the output of all nodes of a type or even a specific, individual node**.
106+
107+
- **Extensions are a lot more powerful now**
108+
109+
The extension system is being completely redone and will tie in really really well with the new parser and
110+
**Reverse Converter**.
111+
112+
- **Faster (it seems)**
113+
114+
RegExps, specially the complex ones, are slow. So, moving away from them, and only using RegExp for quick checks,
115+
should speed up the parser a lot. Well, at least in theory.
116+
117+
118+
## Not everything are roses though
119+
120+
Unfortunately, to accomplish this and successfully move away from RexExp, 3 things were needed:
121+
122+
1. Keep the extension logic simple (while making it more powerful)
123+
2. Time
124+
3. Accurately estimate number 2 (time needed vs free time)
125+
126+
127+
While I feel that the first one is being accomplished quite nicely (if I may say so myself), **I might have over estimated
128+
my free time** and I definitely failed at number 3. Which meant I had to keep delaying the alpha release for v2.0, which
129+
I intended to release in mid 2018.
130+
131+
Between work and family, the little free time I get, I dedicate it to this library. I do feel that things
132+
are still going on the right track, albeit a lot more slowly than expected (and than I wished for).
133+
134+
Regardless, **I'm really excited about the new features for version 2.0, specially the reverse converter and how it will tie in
135+
toegether with the new parser and event system**
136+
137+
138+
## I would really, really, really appreciate if you could donate, you know?
139+
140+
For all those reasons, working on the 2.0 version consumes a lot of my free time which, unfortunately, I don't have that much lately.
141+
142+
I would really, REALLY appreciate if you could donate. Your contribution will mean a lot to me and really help me
143+
dedicate less time to my dayjob (and those annoying extra hours) and more time developing this (awesome) library.
144+
145+
So... if you like my work and find our library useful,
146+
please donate ~~[through Patreon (coming soon)](https://www.patreon.com/showdownjs) or~~
147+
directly [through paypal](https://www.paypal.me/tiviesantos)!!
148+
149+
Thank you!!

blog/showdown-1.8.7-released.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
«««
2+
title: Showdown 1.8.7 released,
3+
author: Estevão Soares dos Santos,
4+
author_avatar: img/avatars/tivie.jpg,
5+
date: 2018-10-16,
6+
language: en,
7+
image: img/blog/2018.10.16.jpg,
8+
summary: While everyone's waiting for the new Showdown 2.0, I released version 1.8.7 with some improvements and several bugfixes.
9+
»»»
10+
11+
Showdown's version 2.0 is coming together although not as fast as I wanted, maybe
12+
[due to the extensive refactor done to the parser][rewriting-the-parser]. But while the community is patiently waiting,
13+
I felt that some important bugfixes could (and should) be backported to v 1.x.
14+
15+
16+
## What's new in 1.8.7?
17+
18+
Some long awaited bugfixes were backported, namely:
19+
20+
21+
* **emojis:** fix emoji excessive size
22+
23+
* **gfm-codeblocks:**
24+
25+
* add support for spaces before language declaration
26+
27+
* leading space no longer breaks gfm codeblocks
28+
29+
* **images:** fix js error when using image references
30+
31+
* **literalMidWordAsterisks:** now parses single characters enclosed by * correctly
32+
33+
* **mentions:** allow for usernames with dot, underscore and dash
34+
35+
* **nbsp:** fix replacing of nbsp with regular spaces
36+
37+
38+
39+
You can download/use the new version from [github], [npm] and [CDNJS].
40+
41+
42+
[rewriting-the-parser]: http://shwodownjs.com/#!/blog/rewriting-the-parser-challenge-or-opportunity
43+
[npm]: https://www.npmjs.com/package/showdown
44+
[github]: https://github.com/showdownjs/showdown
45+
[CDNJS]: https://cdnjs.com/libraries/showdown

0 commit comments

Comments
 (0)