markedjs / marked

A markdown parser and compiler. Built for speed.
https://marked.js.org
Other
32.79k stars 3.38k forks source link

Consider the support of macros. #445

Closed howardroark closed 6 years ago

howardroark commented 10 years ago

Firstly, this project is great!

I work in the advertising industry and can see how Markdown will start to make headway there. The usage concept is simple enough that new writers and some old will have an easy time getting getting their mind around it. This was always the downfall of HTML. I can foresee a future where developers are delivered plain-text/syntax instead of MS Word documents (or even better never involved in that process again). The industry has a very strong desire to maintain brand identity at all times and Markdown is such a sane way to separate content and style. This is especially true for slide based presentations, which is how agencies acquire all new work. The de facto today is Keynote. It lacks the ability to separate content and style and also has no remote execution ability. Two things that the modern browsers can do with great ease.

That said, there are certain economic trends that need to be accounted for. Third party things like youtube, vimeo, twitter... All of these things have libraries/APIs and industries are aware that they should be able to easily find their way into web based content. It is a rational expectation. The issue is that you end up falling back to HTML again.

I came across this example of Macros and thought it was a very sane approach. The trick would be the overall strategy to get custom Javascript in play without having to add it to marked.js itself.

Designing a common syntax for handling Macros that other projects could be helpful to the future of Markdown as well. Something like this would be so handy...

![:macro params](value)
![:vimeo 600x400](13697303)

Though, this may be a bit more sane...

![:macro](Params, Values, Jison... pass to parser as a string)
![:vimeo](13697303 600x400)

I can also see a lot of potential for this idea in terms of scientific writing. A Macro that could parse natural language with something like Jison into a diagram could be very useful. Though when something like Jison is involved a multiple line syntax would be helpful.

![:venn](
Soccer = alex, casey, drew, hunter
Tennis = casey, drew, jade
Soccer ∪ Tennis
)

Maybe better?...

!!:venn
Soccer = alex, casey, drew, hunter
Tennis = casey, drew, jade
Soccer ∪ Tennis
!!

Spit out some Canvas or SVG...

I understand that this may be out of scope for this project, though I feel this is something that should be accounted for at the parser level. Having a common syntax for dealing with these situation and an expectation to pass natural language as an input would really aid the process of fluent writing and idea generation. I could be as simple as having a venn.js or vimeo.js in a folder called macros which is relative to the path of marked.js.

golyshevd commented 10 years ago

Omg i was created a duplicate at #466

howardroark commented 9 years ago

I have been further considering this idea and have posted my latest thoughts to jgm/stmd#123