cgiffard / duckdown Goto Github PK
View Code? Open in Web Editor NEWUltra-simple Markdown-inspired markup language.
Ultra-simple Markdown-inspired markup language.
Consider the following chunk of Duckdown:
"I'm so against this proposal, I don't !even want to hear! from you about it again."
In this circumstance, determining what section of the text is to be emphasised is easy. The first character is directly succeeded by a word character (that is, [a-z0-9]) and could not possibly be an exclamation mark. The second simply terminates the tag.
However, it is not easy to programmatically determine where the emphasis ends in the following:
"I'm so against this proposal, I don't !even want to hear! from you about it again!"
Do we operate on a first match basis? Then what if somebody is trying to use emphasis across a sentence boundary with an exclamation mark?
"Wheelchair manufacturers should !always test their products according to appropriate standards! Safety should be a priority.!"
The intention of the above is that the phrase is emphasised from four words in, right the way through to the end. However, a first-match algorithm would both emphasise incorrectly, terminating the emphasis four words early - as well as swallowing the exclamation point terminating the first sentence and damaging the readability of the phrase.
So what about a greedy algorithm? It suffers from the same problem, just in reverse:
"This fire blanket should !only be used in an emergency!. Folding it back up is annoying and time consuming!"
The intention of the above is to emphasise four words in the middle of the phrase, but the greedy algorithm will erroneously continue all the way to the end of the phrase, again swallowing the final sentence punctuation.
This may occur for a number of different tokens in Duckdown, not just emphasis. Therefore, it's important we start thinking about rules to deal with situational ambiguities. In many cases, specific matching or some context-sensitive smarts is enough to parse properly with the intention of the author intact. But in this case, I think it's too hard.
In my mind, we've got two options.
!!
instead of !
.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.