Edit or run this notebook
5.0 s

-[* Dashes, Brackets and Stars -[*

md"
### Pain Points and Potential of Markdown in Pluto

An opinionated 'lightning talk' by Jeremiah Lewis

2021-04-08
"
7.5 μs

Pluto.jl is a great tool

But unfortunately it's easy to end up with something that looks like:

5.1 μs

UndefVarError: $ not defined

  1. top-level scope@Local: 1
---

0️⃣ Truncated History of v0.x Julia

'Nothing else can solve my problem except Julia' era.

Language

  • High performance

  • Replace two languages (e.g. Python and C++) with one new one

  • Explosion of 'Julia for X' packages, from power grids to differential equations

Community

  • Community-driven language design effort 'after the emergence of data science'

  • Specialist community with lots of scientific users

  • Hype 'spikes' in general data science community which would quickly diminish

19.0 μs

1️⃣ Truncated History of Post v1.x Julia

'Why would I need to use Python' era.

Language

  • Easy to write code

  • Package manager best in class (vs Python, R)

  • Ecosystem mature enough to compete on 'just another data science project'

Community

  • Subject matter developers come together within ecosystems like Queryverse, JuliaData, SciML

  • Increased, durable visibility in general data science community

  • Lots of content generation: blog posts, high volume Discourse, active Slack, Twitter community

15.0 μs

Two Waves of Adoption, Two Target Audiences

1. Performance Pros

  • Significant general computing experience

  • Often become Julia package maintainers

  • Used to language's 'quirks'

  • Sold on Julia's performance advantages

2. Amateur Adopters

  • Limited time writing Julia code

  • In general, skew towards 'computing' newcomers

  • Intrigued by Julia's ease of use

16.0 μs

👏 Pluto Converts ‘Amateur Adopters’ to Julia 👏

  • Simply ‘a better notebook’
  • Introductory course material lets you ‘follow along’
  • Expressive syntax with an emphasis on Markdown!
24.7 ms

In Pluto, combining text and code with markdown is as easy as $(1+1) = 2

...but not so fast...

17.8 μs

Danger ‼️ Here be dragons

There are many longstanging 'quirks' to Julia's Markdown support. Let's look at one example below:

2.9 μs
var
1
100 ns

For example, as reported here, the following code:

md"$(var) value is has newline. But next inline use of $(var) works as expected"

Yields this output:

1

value is has newline. But next inline use of 1 works as expected

16.1 μs

And here:


$(1 + 1) $(1 + 1)

$(1 + 1)$(1 + 1)

 $(1 + 1) $(1 + 1)


 $(1 + 1)$(1 + 1)

Yields this inscruitable output:

4.5 μs

(1+1)$(1+1)$(1+1)

(1 + 1)

2 2

(1+1)(1 + 1)

16.0 μs

Julia’s Markdown challenges known since 2016…

5.1 μs

Why has progress on Markdown stalled?

  • Markdown is part of stdlib and used throughout core language for docs

  • Existing features of 'dollar math' and 'dollar interpolation' relied upon by advanced users, but mean that 'intuitive' parsing is at times impossible

  • Test suite is not comprehensive, changes to code can have unknown consequences

But Julia manages to elegantly solve far more difficult issues...

Why does Julia struggle with Markdown?

  • Julia solves 'two-language problem' by creating a 'two-community' problem

  • 'Pros' and 'Adopters' share a single language

  • 'Pros' are familiar with (avoiding) quirks, use Julia for comparative performance advantages

  • 'Adopters' demand 'ease of use', but often not (yet) in a position to contribute code towards this goal

23.2 μs

Julia’s Package Ecosystem Comes to the Rescue…

  • Use CommonMark.jl!
  • cm macro is a drop-in replacement for Julia Markdown’s md
using CommonMark


cm"
$(1 + 1) $(1 + 1)

$(1 + 1)$(1 + 1)

 $(1 + 1) $(1 + 1)


 $(1 + 1)$(1 + 1)

"

yields:

5.6 μs

2 2

22

2 2

22

27.4 ms

CommonMark.jl Resolves Markdown Issues

  • Consistent, normed Markdown implementation

  • Independent spec test suite which is used across many languages beyond Julia

  • Dollar math, which is related to many issues and ambiguities is deactivated by default, instead just use ```math !

11.2 μs

Conclusion…

4.3 μs

There are some things CommonMark.jl can solve, for everything else, there's community building...

  • Julia solves two-language problem, a technical hurdle

  • This creates the 'two-communities sharing one language problem', a human one

  • In order to maximize the potential of Julia's technical advances, it will be necessary to align the interests of the different Julia adopters

10.8 μs

A final warning

Just because Julia can enable the development of high-performance and easy-to-use applications doesn’t mean it will…Markdown is sufficient proof and the oldest issue summarizing these challenges dates back four years to 2017.

4.6 μs
Loading...i