Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Remove extra symbols from complex formattings sentence. #59

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

miry
Copy link
Owner

@miry miry commented Jul 26, 2022

The original post: https://jtway.co/speed-up-your-rails-test-suite-by-6-in-1-line-13fedb869ec4

In medium it looks like

image

But in Markdown has a single * in front of line:

image
https://github.com/jetthoughts/blog/blob/master/_posts/2017-06-13-speed-up-your-rails-test-suite-by-6-in-1-line.md

***Paul Keen** is a Chief Technology Officer at [JetThoughts](https://www.jetthoughts.com). Follow him on[ *](https://twitter.com/ChrisKeathley)[LinkedIn](https://www.linkedin.com/in/paul-keen/) *or [GitHub](https://github.com/pftg).*

For example:
***Paul Keen **is a Chief Technology Officer ...* => **Paul Keen** is a Chief Technology Officer

@miry
Copy link
Owner

miry commented Jul 25, 2022

Yep, the problem that it depends how Markdown would treat **Word **word. In medium because of WYSIWYG it could mark as bold or italic following spaces.

I would think to always add space after closed notation, but it would lead to double spaces.

As you see the original sentence has 2 formats in same time italic + bold.

miry added a commit that referenced this pull request Jul 26, 2022
miry added a commit that referenced this pull request Jul 26, 2022
@miry
Copy link
Owner

miry commented Jul 26, 2022

I have a bit modified the code to ignore empty links, like it was done in Medium. Also swap closing elements with last space.

miry added a commit that referenced this pull request Jul 26, 2022
Overlapping style and link tags could produce an incredible Markdown.
Because of WYSIWYG, plenty of hidden things that could destroy Markdown.
Introduce a workaround to have swap places last space and closing elements.
Ignore links without anchor text.
There are still more possibilities to break Markdown.

Old render:

```markdown
***Paul Keen** is a Chief Technology Officer at [JetThoughts](https://www.jetthoughts.com). Follow him on[ *](https://twitter.com/ChrisKeathley)[LinkedIn](https://www.linkedin.com/in/paul-keen/) *or [GitHub](https://github.com/pftg).*
```

New render:

```markdown
***Paul Keen** is a Chief Technology Officer at [JetThoughts](https://www.jetthoughts.com). Follow him on* [LinkedIn](https://www.linkedin.com/in/paul-keen/) *or [GitHub](https://github.com/pftg).*
```
@miry miry force-pushed the 59-fix-wysiwyg-formatting branch from 9728525 to a8c5582 Compare July 26, 2022 09:52
Overlapping style and link tags could produce an incredible Markdown.
Because of WYSIWYG, plenty of hidden things that could destroy Markdown.
Introduce a workaround to have swap places last space and closing elements.
Ignore links without anchor text.
There are still more possibilities to break Markdown.

Old render:

```markdown
***Paul Keen** is a Chief Technology Officer at [JetThoughts](https://www.jetthoughts.com). Follow him on[ *](https://twitter.com/ChrisKeathley)[LinkedIn](https://www.linkedin.com/in/paul-keen/) *or [GitHub](https://github.com/pftg).*
```

New render:

```markdown
***Paul Keen** is a Chief Technology Officer at [JetThoughts](https://www.jetthoughts.com). Follow him on* [LinkedIn](https://www.linkedin.com/in/paul-keen/) *or [GitHub](https://github.com/pftg).*
```
@miry miry force-pushed the 59-fix-wysiwyg-formatting branch from a8c5582 to cdf01ed Compare July 26, 2022 09:53
@miry miry marked this pull request as ready for review July 26, 2022 09:56
@miry miry added the enhancement New feature or request label Jul 26, 2022
@miry miry merged commit cdf01ed into master Jul 26, 2022
@miry miry deleted the 59-fix-wysiwyg-formatting branch July 26, 2022 10:01
@miry miry changed the title Remove extra symbols from author name Remove extra symbols from complex formattings sentence. Jul 26, 2022
@miry
Copy link
Owner

miry commented Jul 26, 2022

Example of changes after that PR: miry/miry.github.io@4a19558

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant