Ben Zorn: Welcome. So it's a great pleasure...

advertisement
Ben Zorn: Welcome. So it's a great pleasure to welcome Daan Leijen, who's going to be talking today
about Madoko. So let me say a few things about Dan before we start. So Daan joined Microsoft
Research in 2006, and he's been -- all the time he's been here he's really been interested in type systems
and the kinds of things you can express in types; and in particular, he's generated some very useful
technology along the way. So in particular if you use C# and write paralegal code, you probably used
to test parallel library, which he was a primary designer for. If you write code in Visual Studio online,
you might use the online editor, the browser-based editor Monoco, and in fact syntax highlighting,
you'll see Monaco is due to Daan's great work. He's done really interesting things across the board
here.
And today he's going to talk about something based on another language he created called Koka, and in
particular, a very useful replacement for LaTeX. I consider it the LaTeX of the 21#st# century, so
you'll see why in a minute, Madoko.
And by the way, if you have questions -- this is for the online people. If you have questions, there is an
ask questions online. So if you type it in into RESNET, it will show up on this Tablet of mine and I can
ask the question in the room.
Dan Leijen: Thanks. Also, yeah, so I'm Daan. And I'm going to talk today about Madoko. It's not
really a science talk, it's more a tool demonstration talk. And I hope it will be sweet and not in short.
So it will be great.
And normally I do a lot of, like Ben already said, a lot of type systems design. And recently I've been
working especially on thinking about side effects and how to track that in a type system. So I was
writing all these papers with lots of unintelligible math in it, and I thought, "Oh, it's a great type
system." Then the reviewers came back to me and said, "Yeah, we like it, but it doesn't really work in
practice, right. In theory we see it works." I thought I have to write a few bigger programs with my
new language, Koka, that does this side effect inference. But what kind of great example program
should I write. So I thought normally people write their own compiler in their own language, but I
thought I would do something else. And why not do a word processor; right? I wanted to follow in the
footsteps of Newt and our esteemed colleague Leslie Lamport, and they began touring the work too in
the future. [Laughter] So that would be great thing to do.
So nowadays, when people think about word processors, what's really popular online with the young
kids is Markdown. And Markdown is kind of persuasive throughout the internet. And the biggest users
are like GitHub and StackOverflow. But it's been invented a while ago by a writer called John Gruber.
And he wrote a lot of blog posts and he wanted a nicer way to write his blog posts. And he just needed
HTML out of it, but he was really thinking about "How can I write something that looks like a text
email and then formats nicely?" And as a writer, he wanted to be able to really concentrate on his
writing and content and not anything else. So he loved like plain text editing, and he wanted it to look
like a very readable document on its own in the plain text, but then format nicely. And it became very
popular.
So there's many, many places where Markdown is used. And also maybe it's most surprising, in very
non-technical communities where people like it a lot. Like it's a special Markdown variance for writing
movie scripts, for example, and people use that all the time.
So I thought, "Hey, let's write a Markdown processor in my new language, Koka, to show that my type
-- my side effects type system really works. And that's what I've been doing. And of course once I
started doing that, then it became bigger and bigger, I thought, "Well, I can almost write my own papers
in this new Markdown. That would be cool." So I made something that I call now Madoko, and it's
basically an extension of Markdown that makes it great for more serious use.
>>: Markdown is a succinct language or a style?
Dan Leijen: Yes, so Markdown is -- so John Gruber invented Markdown, the style of writing these
kind of documents. You write star for a list and then it renders nicely as a list. And he made also a
little program called Markdown. But then in the wild many people made extensions and Markdown
processers. So Markdown is now this common denominator of documents that look like this. But it's
not officially -- there's no official standard for it, although they're working on it.
So when I say Madoko, I want to kind of stress that it's a variant of Markdown that makes it good for
serious use. So one of the big problems in Markdown is its too simple. Like it's great if you want to
write something really simple. But if you want to write an article, an academic paper, a big technical
document, you need many things like cross-referencing and tables and figures and all these things. And
standard Markdown doesn't do that. So Madoko is Markdown on steroids. And I made some judicious
extensions, so that you can actually define your own behavior. So in particular, with Madoko, you can
create beautifully HTML and PDF, which is really nice, so your paper comes out both in HTML and
PDF. It's really nice to read and write, because it's basically Markdown. So when you're writing your
content it looks nicer than if you write LaTeX.
And you can do still all the complex stuff that you would like to do, like numbering stuff and
references, citations, mathematics, and all kinds of funny transformations on your text that people like
us like to do a lot. And I'll give a lot of examples on that later on when I demo the thing for real. And
I'm trying to avoid all the things that make LaTeX hard. Actually I'll show an example of that.
So here's a paper I recently submitted on a Koka type system actually. So it's all generated from one
Madoko source. So this is the PDF version that comes out. If I wouldn't be in F11, it would bump up
here. So just a -- it's a regular "llncs" paper. You wouldn't be able to distinguish it because it's
generated by LaTeX in the end, at the backend. So it's just a real paper. Of course, you know, it has
things that make you think, "Oh, it's kind of nice. Look at all this code. It looks nicely typeset with
colors and everything." And you wouldn't usually do that in LaTeX, because it's a lot of work to do
this; but you'll see like this alignment nicely, and that's usually hard stuff to do in code.
You know, there's still a lot of math in here. Let me see if I can find. Here's some -- where's math?
Later it will align, there will be a lot of math. Don't worry. Lots of code. There it is, a lot of math.
Here's like a bunch of type rules and a figure and, yeah, you can do all these things. It's all generated
from Madoko source.
And if you want to read this paper on your phone, you're not happy because it's like PDF and you're
zooming in and out and scrolling through it. I don't know if you've ever done it. So actually there's
also an HTML version generated at the same time. Hey, it looks kind of like, hey, it is the same paper.
You see the code, it's slightly different font because it's HTML. But yeah, it's the same paper with the
same math in there. Like let me see if I can find the math again. There we go. The same math rules.
And it's a real HTML thing. You can like make it bigger or smaller. So it's cool. And yeah, it's all
there, right. So it's actually --
>>: The math in HTML is images or LaTeX for HTML?
Dan Leijen: There are different ways to generate it. You're too advanced already. So actually, in this
one they're images. But done in a nice way. As you can see they look sharp. It's not like the old
Wikipedia stuff. And I think it looks the best. But you can also use other backends and you can
generate math [indiscernible]. It's not there yet. Maybe one day it will look good. But now the nice
thing about this is it looks exactly like the LaTeX. There's no difference there. Also show a lot more of
it.
Other things, well, you saw it already. Like there's lots of things like references and bibliography stuff.
And of course in the HTML you can do more, right; it's easier to link, it's easier to have little popups
like that and jump to stuff. I just happened to be the last one. And HTML, I generated these little
search icons so you can search for it nicely on the web. Let's use Bing for that today. So back to the -so it's all generated from the same source. And later I'll show you the actual source.
So first I think what I want to stress is that what makes it fun to write in Madoko is that it's just a little
bit more pleasant than we're used to. Well, you know, you could argue there's no real difference; like if
you write an item or two dots, it's not a real -- but in the end, your whole document, it just feels more
pleasant. It is true that you feel more like you're working with the content.
Other things that Markdown does is saying like, "Well, if I want a link, I don't want to interrupt the
flow." So I put the real link underneath here, underneath my paragraphs, and then I just use these little
brackets to say what the link means. So you have more of the flow of your text. And it's -- actually
here's the results, what it looks like.
So the same with like code. This is actually real code that I was writing a while ago. On Madoko you
can write the code; it's much more lightweight to write that kind of stuff. Your text becomes more
apparent what's going on. And here this is a rendering in LaTeX of that particular piece of code.
So you see that in Markdown, for example, it says, well, if you indent four spaces it becomes code, or
if you put things between these back loads, it's like in-line code. So it's like this lightweight annotation
mechanism. I'll get to that later.
But I think an important part is that in the end it's still text files. And one reason why it was so popular
is it was easy to take these Markdown documents, or Madoko documents, and transform them into
something else and do some processing on it. And I think that's part why LaTeX is also so popular, is
you can kind of see it and mess with it. And it's a really good thing about Madoko. So it's much easier
to process it. And in contrast still LaTeX, I'll give you lots of ways to easily transform the document
inside your own document. I'll show that later.
>>: It's a synthesis engine.
Dan Leijen: Aye?
>>: It's a synthesis engine.
Dan Leijen: I hope so. Yeah, you're like a rule that generated documents.
>>: That's a compliment.
>>: I'm rooting for the masses.
Dan Leijen: So in the end, though, I still use LaTeX for mathematics, because LaTeX is great for
mathematics. And all the papers that we do, we love using that. So if you want to use math, yeah,
you're still stuck with kind of difficult commands, but you'll figure out that math is quite easier in
LaTeX.
So this would look like this if I would write this in my presentation. And, you know, you can do crazy
LaTeX too, which is important, because if you're writing your paper and you're like on your deadline
and suddenly you need something amazing, hey, you can actually do it. This is like PS tricks magic,
you know, I copy and paste it. So it's all supported right there. I should have shown the source; it's
kind of fun.
So another big thing is like the code -- we rewrite a lot of code, and if you look at how we want -- we
would love to see code highlighting in the code or we would love to put like special characters in the
code. And all these things are usually very hard to do. So in Madoko, I really try to make that easier to
do. And so, yeah, it's all there. It's like a great command line program that does it.
But then I took it a little step further we putting all this in the web. And that was -- it was kind of
interesting that my side-effect language really came into play here. So I wrote this initial command
line program that would process Markdown, and I wrote it only in Koka, and then I kind of realized
that 95 percent of the program was underneath this Markdown function that processes strings and
options and gives you back a new string of like HTML output, for example. And I saw it only has two
effects. And namely, it may diverge or raise exceptions. And it's pretty good. Because that really
means that everything there -- they don't have any other side effects, like it wouldn't read from a file or
get the option from a global variable or read include file through to the file system or something.
Which meant I could actually run this program both on the server or client. So Koka generate
JavaScript in the backend, and it knew that the JavaScript for all of this can be seamlessly transferred
between server or client with exactly the same behavior. And that kind of opened up the way to make
this whole thing completely online as an HTML5 web app, and that's what I'm going to demo now.
And that's really cool, because suddenly I could integrate with services like Dropbox or OneDrive and
GitHub.
And now another big part of writing a paper, namely collaborating with others, became much easier.
Because you can now just start writing with someone else on the same paper. You don't have to set up
your special repository stuff. It will just work. So I'm going to show that right now.
Ben Zorn: So just before you do that, so just to clarify, somebody on the web asks, "Have you tried
submitting a paper written by Madoko to conference or journal, and will they accept it?"
Dan Leijen: Can everybody hear? So the question was if people wrote a paper in Madoko that you
could actually publish at a conference. So the answer is clearly yes, you can. Because the paper I
showed in the beginning, that is one of those papers; right. And it looks exactly like the one you would
generate with LaTeX. So there's no way -- yeah, it is the same thing. It's easy to do actually. So ->>: So just to confirm then, it would follow the margin rules and indents and things like that into -you know, submit the file ->>: I've done it and submitted it already, and a beautiful part is you get not only HTML and PDF out,
but you get tech out, but you send it to EasyChair, you press the button saying compile it, and
EasyChair, it says it's a great document. So fundamentally, there's many backends. And of course, on
the way to LaTeX it's going to produce all the files you need to LaTeX it. So with a publisher, and you
can drop in your style file. And Daan's been awesome in -- he understands the fact that we are
publishing and publishers have all these requirements. So it works.
Dan Leijen: So maybe before I show other stuff I should show that, like how you would write papers.
So here's Madoko.net. It's actually a real demo like Madoko.net I'm going to do. You can do that too
in your own home. I'll make the screen big because I promise that. So here's what you would see. But
you could kind of say -- let me -- how would I do it? So we could kind of say here, like if I generate
LaTeX, I get some -- I could maybe say this is the editor. Here's like a preview of what you're seeing.
This is all on the web. And I just generated a PDF file, which I will open now. And here it is, right,
here's a PDF file. And it uses standard article style.
But what I could do is say, "Oh, I want to actually submit to SigPlan, for example. So what I can
actually do is I can open up some -- I can have the SigPlan conference style here, like it's a class file,
CLS. So I grab it and I drop it here. You see it says document class SigPlanConf. And it's actually in
here in my files. Here is the style file now. And if I now generate the LaTeX, let's see if it works. Oh
my God, never do these kind of ever demos. So now it says sending -- okay, so it's done. So it sent it
to the server; it generated the LaTeX. Did it work? Right, it did work. It just -- oh, right there it is.
It's too common format, so you can't really see it. You can see like shorter. If it's longer it will go in
the second column. You will see here suddenly the ACM stuff. So it's only like in SigPlanConf style.
And actually I have a bunch -- maybe I'll share that too. If you do a new document here, you do a new
document, it says "Oh, you know, you haven't saved your local document. You were messing with it;
but I don't care about it. So I'm going to discard it." And I'm going to do a new local document, and
then actually here there's a bunch of predefined guys, like LIPIcs. That's funny; right? There you go.
Like here's more other kind of style files. So it looks cool in the preview. Then I generate the LaTeX,
you get a real LIPIcs-style file. I'm going to show that. This is one with pictures and math. It kind of
shows more difficult stuff. There we go.
>>: Question.
Dan Leijen: Yeah.
>>: Are you generating CSS corresponding to the CFS file for the HTML preview?
Dan Leijen: Yeah, right. So this is the LaTeX one. It generated just section commands and everything,
the normal stuff. But because I imported the LIPIcs style file, it created little yellow boxes, for
example, around the numbers, because that's their file. But when I have a list, it does little gray
thingies. So that's their style. So what I did, when you open up a standard one in the new, I wrote
some of the CSS for the preview that imitates that style as much as I want it to. Because there's a
service to the user. Of course in the end, Editor should really provide that for us. But now it looks
more like the LIPIcs style, for example, sensory font for the headings, for example.
But I think the big thing is -- did I show the PDF?
>>: Yeah.
Dan Leijen: All right. So the big thing is that you do use whatever the publisher wants as its style file,
and that's an important thing.
>>: So can I return to something you did just a minute ago, which is that it prompted you to discard a
thing that was not saved.
Dan Leijen: Right.
>>: That's because you hadn't backed it up with SkyDrive or something like that; right? Because if
you're in the Cloud and it's a saveless world. You're just always there. It's only because it was a
browser local document that it -- okay, good. I'm a new user, so [indiscernible].
Dan Leijen: That's exactly right.
>>: I hate to say, save is a stupid concept that should have never existed. So I want to make sure it's
gone.
Dan Leijen: So the nice thing is, if you use your document on Dropbox or OneDrive, it will be
automatically saved all the time, like about every 30 seconds. And it saves continuously your local
storage in the browser. So even if I just hit refresh or close the browser, it will still be there, like almost
every keystroke. But this other document it was just local; it was never in the Cloud anywhere. So that
would be a good thing.
>>: [Indiscernible].
Dan Leijen: The actual important thing, something that made me realize, so when you open -- when I
started working with someone on, say, a Dropbox folder, I realized I have a better backup than
normally. Because you're in this web thing. But every 30 seconds it's sent to the Dropbox Cloud
storage, which is probably better than my hard-disk, and it synchronizes all my other devices on all my
harddisks, and it saves every version up to a month of all the articles. That almost means like every 30
seconds you have a version on Dropbox that you can go back to and look at. So I would say it's a very
secure way -- more secure probably than how I normally write my documents.
So if you integrated GitHub though, you have to commit yourself every once in a while. Because that's
a storage model, right. So then you still -- there's still kind of a save at this point.
>>: It fix the numbering?
[Laughter]
Dan Leijen: I can do that. So [indiscernible] and I fix the numbering, because it doesn't like to start at
1, it likes to start at 0. And actually I made a special rosting style [Laughter]. So I think if I do 0 here,
it will start right. There we go.
[Applause].
It start with 0's instead. So I need the 0 style to do it. You see also it figures 0 in section 0.
[Laughter]
Actually, so let me get back to that. So I'll do a little -- right, this is also a local document. I'll do
another default document here. I wanted to show a few more things about what you can do in
Markdown. So one thing we already saw, like lists, so this is like simple stuff. Two, three. And I think
the nice thing, though, is it's very obvious what to do. So if I want to make this like a Roman numeral
list, maybe if I type "I" -- oh, great. It's a Roman numeral list now. Or if I maybe do like a capital A,
it's A, B, C. So it's like maybe slightly more easy than normally would think it is, or start at 6. So
those are nice things.
And other things which are nice is like cross-referencing. This is something that's really important for
everyone and we want to be able to do it. So big extension in Madoko is you can add attributes to stuff.
Like here's a section header in Madoko. I could say, "Well, this is like the introduction," and then
everything is like HTML CSS base. So this is like an identity I give to the Madoko header that's the
introduction, and I can say "See section introduction." And it will be like, "See Section 1." And if I
hover on Section 1, it will say this is the Madoko chapter. Everyone can read this by the way.
So that's easy stuff. Then, of course, you can name many things. Like maybe I'm going to write some
equations. Let's write a nice LaTeX equation. What is it, limit [indiscernible]. I think it's something
like this. Probably. So right, so there's a little red guy over here that tells you about LaTeX errors.
That's nice, like -- well, it's still a LaTeX error, so it's not amazing. But hey, maybe now you can
actually find out what you should be doing. And here you see it's still being rendered, like grayed out.
That means it's sent to the server, and then it's rendered at a certain point, and then it's right there. And
there's a nice number. And of course, if I want to refer to this equation. I could say, "See equation
Euler," and then I refer to Equation 1.
And similarly I can make up other blocks. Like theorem blocks or something. And maybe here I'm
going to say it's Euler, let's say theorem Euler, and maybe I'm going to give it the caption. So I can
make more and more little attributes. "We are proving something." Right? They can make more and
more attributes and will like come out like this.
But the funny thing is the theorem thing is not something that's built into Madoko; it's something you
can define yourself. And you can kind of look up how I defined it. And then you can do stuff with it.
For example, can you make little rules here about theorem blocks. So you can say, "Well, if you see a
theorem block, maybe the margin on the left should be 1M," and then the whole thing would jump a
little bit to the left.
And maybe other things you want to do is like saying, "Oh, I might want to number them a little
differently." But it turns out that the actual number is called the label of something. You could say,
"Well, instead of the theorem counter, should really be lower alpha," or something, right. And it's like
Theorem A now. And maybe you're going to do other stuff. You can do a lot of stuff there. So you can
basically define completely how you do your labeling or numbering.
>>: [Indiscernible].
Dan Leijen: Say again?
>>: Why is "et theorem" [indiscernible] specify that?
Dan Leijen: So everything with ts are counters in those attributes. And then you can set like how they
are displayed.
>>: So it doesn't matter what you named Ets, you could have named it anything and it could have -oh, there's a counter, it happens to be named [indiscernible].
Dan Leijen: So actually it turns out that everything you do here, I make up a counter for you already
that's named after the block. There is an equation counter and a theorem counter and an H1 counter.
>>: So it does matter that it's theorem, should be the right counter. Because you named [indiscernible].
Dan Leijen: And it's really because in the basic style file, I said the label of theorems -- you see the
number, it's kind of defined like this. It says the label is Et theorem, like the counter theorem, plus a
dot, I think. No, a double dot. So it's like the counter theorem. And I can put something in front of it,
right. I could say, "Oh, also do the section counter and a little dash." And the -- oh, it's actually H2
here, because it's sections. I don't know what it's doing. H1 maybe?
Anyway, so you see here right on this -- right. Right. Dot, that will do it. So here you see like 1.A,
because I said, "Oh, it's really the counter of the sections plus little dots plus the counter of the
theorem." But this is pretty advanced. But I'm going to want to say like it's very flexible in how you
define these attributes and how you can specify your own blocks, your own things. Like exercises and
answers and those kinds of things.
One other advance thing I would like to show is about code. So often we write a lot of code. And one
way to write code is between these little BibTex. You could write function, hello, [indiscernible] like
this and we love writing code like this.
>>: Looks funny.
Dan Leijen: It does look funny. So right here we could write -- you see the code over there and it's not
highlighted. Well, it turns out you can automatically highlight with fancy descriptions, code
automatically. And this is how you saw in my papers how the Koka code was like nicely highlighted.
And another thing you may want to do is often in code or any other kind of block, you would like to
kind of make little replacements and do transformations on your code. So one example is if I write
here "pi is 3.14," I may want to use the real symbol pi over here. Well, how do I do that? Because
we're inside code and this looks just like code. Well, you can escape back to Madoko using special
escape sequences. And then insert funny stuff like a piece of math that evaluates to pi. So you kind of
see that I'm rendering here in mathematics, and then it inserts little pi character.
But in general, you would like to do that maybe for large pieces of code, or code that's included. There
are many kinds of transformations you might want to do. You may also have a little fancy back arrow
for example. So you would like this back arrow to appear like a nice back arrow. You may have many
other symbols. And it often occurs in your papers. So you can make more rules to do this kind of
thing. Like you could say, "Oh, for all the code I want to do a replacement rule." So if I find this backlooking arrow, then maybe I'm going to insert some LaTeX that does a left arrow everywhere. And I
wrote a little regular expression there to do it. And it didn't work.
>>: [Indiscernible]
Dan Leijen: Oh, there it is; it is actually working. There we see the nice arrow popping up. And this
way you can actually write mathematics or code in really nice ways. And it gives a lot of power to do
transformations on basically any block you have. Like there's no -- I did it now on code, but I can take
any piece of code and transform it in these ways.
>>: Are these transformations, these related to its style? So if I had multiple pre-blocks in my
document but I wanted this particular transformation app only to -Dan Leijen: JavaScript for example; right? Right. So you could do here, you could say only if it's
JavaScript. And then now I use a class rule.
>>: But what if I wanted only some of the JavaScript?
Dan Leijen: Right. Oh, okay. Like, you know, you can say, "Oh, I add a little class, my blocks, my
block, and then do my block here." But of course the whole idea of Markdown is you write this nice
text that you really read, and it's like pleasant on its own. So the more you're going to add like funny
attributes, the less you're -- you're like puring the Markdown spirit. But it would be great. So this pi
stuff is really frowned upon. So it's great to have a rule at the beginning such that your code here will
look really nice.
>>: So is this similarly how I would do something like a LaTeX macro? Like I've seen a million
times, people want to delay the decision about what their thing is going to be called in the paper, so
they give it like a little macro name and then they delay find it. So would they do it this way with a
replace?
Dan Leijen: Actually the replace is more for like the advanced stuff, like all the arrows need to look
like this. When you have something like, you know, "my project," you rather use an entity. So this is
how write entities, like "my project." And then anything here that you define will be replaced. If I do
"my project" here as -- you know, "my project," it takes that and puts it right there. So for logo stuff,
it's much easier to use entities.
>>: Instead of using the text for pi, could you just use pi, and enter you can pi very easily
[indiscernible].
Dan Leijen: Oh, yeah, you can. You can just enter the unique code character. Actually here, instead of
LaTeX, you could also do the entity pi, it's like HTML defined. And if you know the unique code and
are able to type it, then that will work too. I have no idea how to input it.
>>: You say that since it's UTF-8 or something, so -Dan Leijen: Right, it is all UTF-8, so it can be like direct funny characters in there and it will work out.
Even if you translate to LaTeX. This has been very hard to make work.
So actually almost to include in my demo stuff, I want to show something else which may be
important. I want to open a bigger document. Again, I'm going to discard what I did. I want to show
like I could go to Dropbox here and go to my Dropbox account. And you see basically all my Dropbox
stuff. There's like Madoko, and more stuff, and my samples. And here's like a big paper. So you see
this paper consists of many things. It's much bigger. So it looks like cool, because it starts with a lot of
these replacement rules, which I used, to do nice mathematics. But I want to -- I'll look here instead.
So here's like lots of includes, because the paper consists of many things; right. So if you double-click
on the introduction, for example -- if I can click well, we can go there, we can go to the introduction,
and you can see how I write the introduction. It looks nice when I'm writing. It's all good. And then it
continues to see the preview here. That works all fine.
And then when you look at mathematics, it's of course complicated, because I use lots of math and it's - what do you say? That's still LaTeX, so you can't remove that kind of complexity; but what you can
do, to use replacement rules, and they're used quite heavily. So here I want to show like this particular
piece. I have an inference rule here. It's like the C Sigma Sigma. And oh, I actually write CS:S in a
little turnstile here, just like textual. Because I have replacement rules that make it into LaTeX
commands and actually found them really useful. Because often you have your own little language and
it makes it much more pleasant to write stuff when you have these little turnstiles available; right. And
of course you can still use any funny commands if you still need that.
So I found that ability to transform like how it looks is much more convenient than defining many
LaTeX demands. Although you can still do it, and I also do it, like I even have math definitions. There
are still a whole bunch of math stuff that we do. But it's just in the mathematics. So your documents
become sometimes a -- you know, the more you write regular text, the more it looks good. The more
you write mathematics, the more you see of the LaTeX stuff.
So other big things are like in this paper I have a big bibliography, and you can refer to it. So here we
refer to -- oh, it's my own paper. I shouldn't use my own paper to refer to, but when you save another
one. Like Watler, like marriage -- like here's Watler with marriage. And this is how you refer to it.
And you see in the other side that it became a little reference. And there is a big -- oh, it's again the last
one. It did it before, right. There's like the list of things that are there. And Watler is right there. And
there's a big bit file from which all this is generated. So if we find our Watler entry -- there it is. And I
later think, "Oh, maybe a made a little mistake in my bit entries. Watler is really like "Watler,"
[laughter] then you'll see that like it will be detected that I'm changing my stuff and it will
automatically re-render all the stuff on the server, and, you know, run BitTech. I don't know what it
does for me. Then a certain point this guy will change back. Right, there's Watler, which is kind of
nice. You kind of remove this whole console stuff that we normally do. But it still integrates with your
standard bit files that you're using.
So another cool thing, which I love, is -- I will discard it; I will go to Madoko -- is here is a
presentation I made today. And the nice thing is that because I'm leveraging all this web stuff, you can
use other people's libraries for doing nice presentations. So you'll see here -- what's up? So you'll see
here that it's -- this is the presentation I'm being given. And it has like all this text in it. And I'll show
you the preview. And when you think about it, it's still sections and lists. It's all just the regular
Markdown, it's just that I style it really specially now. And the style is already done by others that
made big libraries to cool presentations in HTML. So the leveraging on that you get a lot of stuff back.
So other cool stuff, which I couldn't show here today, you'll see these little like multiple guides
sometimes, which means, "Oh, you've shared out this particular directory with others," so you can
actually, if you go here -- what is one that I can show people? Like this one, for example. It says SCA.
So Nicholi Beuner shared it with me when he gave a summer school presentation, and he has a big
[indiscernible]. So you can see there's multiple people in here. That means like Nicholi works with me
and with many other people on this big summer school presentation. And we can all work together.
Here they saw briefly, before it imported the actual style, how it would look like. And then he had this
big presentation with lots spelling errors, I can see [laughter]. Oh, well, things like data log. So
actually you can say "ignore data log" and it will get ->>: You haven't spell checked?
Dan Leijen: Oh, Interpol, I think that's fine too. Well, hey. I see Interpol -- probably ignore the real
one before. So it's big. It's a big presentation. There's lots of math and lots of -- actually so much
math I'm glad I didn't go to that summer school [laughter], because it's really -- like it's out there, I
think. But hey, that's cool.
So for them it was great. And everybody can work together. And if you do, a little guy will pop up in
the corner and show you who's also working on it and where they're working in realtime. So the
merging is still three-way merges, not realtime. But you can see where someone is working. So you
can at least avoid conflicts most of the time.
>>: So is it like Word where there's an implicit lock? So like the way the Word does this is where I'm
currently working there's an implicit lock and other people cannot come in and edit it, which avoids
merge conflicts. Is there something like that here?
Dan Leijen: There's no lock. They can see where the other person is. They can see what is doing in
that point in time because the merger happens just -- the three-way mergers on the Dropbox share thing
or the GitHub share thing, and that means you -- if you can work in the same time on the same part, and
some of you get a merge conflict and you have to resolve it yourself. And you'll see it in the text. Like
I show both pieces and it renders nicely, and then you pick what it should have been.
>>: So it's not realtime, it's -Dan Leijen: It's not realtime.
>>: You may get a merge conflict, something might pop, you'll see two different versions.
Dan Leijen: >>> but you see in Realtime where the other is.
>>: Right.
Dan Leijen: So to do it you have to be a little like evil and go for it. Or, and here's the big thing, right,
which is the real difference in Word or Google Docs. You can both be on plane working on the talk,
and then you come back and you both edit a lot of content, and now you get just like a solid three-way
merge. Yeah, there may be conflicts, but that's part of it. But it means your offline mode works well.
And in particular this whole app is an HTML5 app that's cached, so it works even if I unplug it. I just
only be able to save on Dropbox at that point in time.
>>: So what if I'm in this nice [indiscernible] and I know there's some command but I don't know what
it is; what do I do?
Dan Leijen: Right. Email me.
>>: No, it exists, it exists. I'm looking for you on one of the -- you have a little help.
Dan Leijen: Right, right. So there's two things. First, all of the standard Markdown stuff, there's tons
of help everywhere. Because many people do this. But there's also this help guide here. Like there's a
menu. There's lots of menus. So this is interesting. This is a reference manual that's pretty extensive.
>>: I was thinking of the menu on the left side.
Dan Leijen: Oh, like this one? Oh, right. [Laughter] so this is a reference. There's also this menu you
can put here and then -- I don't know. This is a crazy document to be editing. But suppose I have some
stuff here like "Hi," I want to make it bold. You could like select the thing and select bold. And can
you see Control D will work too. So now it's unbolded. Or you can make it cursive or code. Or you
could make lists. Or, yeah, you could insert a picture. Actually, it let's you insert a picture. That's fun.
So you can just drop a file. I think I showed it before with a bit file. I'll do a Yin/Yang. And then
there's Yin/Yang picture right there. And it will automatically -- like your document is really more than
just your document; there's big files, CSS files. And also these images. But now you put a picture of
me in your presentations. It's like the dictionary of words that you're ignoring, there's all this C++, so
he has the color highlighted there, all these things, which are important in the end for the final
documents. So these are all there as text files. And all the Dropbox synchronize those on your local
machine and you can run the command line program and it will work too.
Anyway, I think I want to conclude my talk.
Yeah, I want to say more -- I think -- I want to say more about the Koka experience. It's been great,
like how I implemented all of this in this language with side-effect tracking. But I think, yeah, we
spent enough time, so I'll skip it and I'll just go to the questions.
Thanks a lot for your attention. And I hope you're going to use [applause] -- use it, and I'll help you.
>>: Suppose I commit to this. This is very appealing. Am I always reliant on the existence of
Madoko.net running and somebody funding it?
Dan Leijen: Right. So the question is, if I use it for my document, what if Madoko.net stops existing;
right? For the good part, there's the command line program, which does exactly the same thing. So
you'll always have all of your files. You can always run that command line program. And it will
translate to standard tech, right, and standard HTML. So you get it -- I would say you're pretty safe. It
would be bad if I die. In many ways. Right?
[Laughter]
>>: It's all Open Source. So all you need to do is get a passcode, bill Koka, get Madoko, build
Madoko with Koka, and you're set. [Laughter]
Dan Leijen: Actually it builds quite easily. Many people have done it. But it is Open Source and you
can just build it right. So you're actually better off ->>: Packages; right? They're node.js packages; you don't have to go there.
Dan Leijen: Right, you don't have to build it. You could just MPM install the thing. It's easy to install.
But if you want -- like if I die, you want to make your own extensions, you can.
>>: Let's move on though. So the [indiscernible] as far as node.js, what does [indiscernible]? Is it
Koka or -- [indiscernible]?
Dan Leijen: So these are general things. And node.js is an environment that uses Chromium in the V8
engine to run JavaScript locally on your platform. And it's mostly used to make web servers. People
think of web servers. But it's really just giving you like an operating system API, like a [indiscernible]
API. And it's very easy to install on many platforms. And that's my target platform normal for Koka,
because Koka generate JavaScript code. And it means that if a [indiscernible] called MPM. So once
you have node.js installed, it's easy. Then you can do MPM, install Madoko, and Madoko is there.
>>: So it's a module in node.js.
Dan Leijen: Yes. And that's all you have to do to install it.
>>: And then you have the visual experience within basically [indiscernible].
Dan Leijen: No, no. I wish that you had that, but you have to go to the website with the visual
experience.
>>: So you have the command line experience.
Dan Leijen: You have the command line experience too. And that would be like using LaTeX. Of
course, for all the [indiscernible], you still have to install LaTeX yourself, which is a hassle. And this is
why the website is nice, because there's like no installs. You just go and write.
>>: Tables, for appearances, the [indiscernible] is presenting large tables of data. What do tables look
like if you're writing on Madoko?
Dan Leijen: They look kind of nice. Let me see. I think -- well, here's a complex table. It was my
challenge thing, like do it in LaTeX. Because normal people have a hard time, like people I know
[indiscernible] R first or 2 first or 3, and then like double lines or stuff and no line, that kind of stuff.
But on the other hand, they're also simple. So let me see -- well, you can do it. And they look kind of
nice. Here, I'll enter the table right here. Let's do it here. Three [indiscernible] table. So here's a table.
This is how it will look like. There it is.
And I give you editor support. So you can like do blah, blah, blah, blah, and then it will like reformat it
like nicely for you. They're pretty powerful. It can do a lot of stuff. So, yeah, it works well. Like
what can I say? Like I don't like -- so never do vertical lines in the table. It's like considered bad. So
this would be a better table. And then can you have little attributes here like [indiscernible] table.
>>: So 1.7 provides [indiscernible].
Dan Leijen: Oh, we're still updating. So now in a really big document, this is like a hundred-page nothappy presentation right. So automatically the websites triples how fast it undates. So if your
document is small, it's like immediate. It's larger, it waits little. So it's like a typing pause. So now
you see all the vertical lines are gone and like these horizontal lines.
>>: [Indiscernible].
Dan Leijen: So then you need learn about Markdown and how it works. So this is centering, and the
other ones are [indiscernible] lines.
>>: Is that standard Markdown? Is that how you handle [indiscernible]?
Dan Leijen: Semi-centered Markdown; right. So all the other ones do it similarly like this. So it
works in tandem, for example, and [indiscernible]. So can you make large tables. And I do support the
long tables that break over pages into PDF, et cetera.
>>: How about, let's say, now I want to write a book and then I want features for a book. Let's say, for
example, I want a textbook, I want text sidebars, I want a bar that are linked, should be placed in closed
reference and all that nice stuff.
Dan Leijen: So this is cool, because what you can do in Madoko is you say you make these custom
blocks, like you saw a lot, like math, or what did I have, theorem and equation? There's the rule you
can define yourself. So it would one that says like side margin. And then you can write pieces of
LaTeX -- see, LaTeX rule blocks that you can write, you can just do your own tech and you can hook
into that particular environment and then say, "Oh, use this and this LaTeX environment and --"
>>: [Indiscernible] to HTML?
Dan Leijen: So the HTML you have to do something else. You would write a bunch of CSS rules. So
you write a little style. You just start writing style. Like, for example, I could just start here with like a
style. Or a tech role block. And then the math, for example here, it has the math class, so you would
do maybe background color. Background color is gray. And it would -- when it updates, I think it is
important -- oh, colon. So, you know, it will just enter this into HTML, but not in the tech. And then
for tech you can write this other role, that is a little more like saying CSS, on class MAC, and then you
do your special commands.
Of course, at this point you need to know what you're doing. Because if you write the wrong LaTeX, it
will break the LaTeX. But it's possible. So this is how most of these things are defined, like figures.
Well, they're built in, because I wrote them, but they're not built into Madoko. Just built-in rules. By
the way, I should have side margin as a built-in rule, because that's nice.
>>: If you shared using OneDrive or Dropbox or something, what do you give access to?
Dan Leijen: Right. So everything. It's a bad thing. Like when you do doubles, Madoko can see your
entire Dropbox, all your folders, everything. I rather have that it was like an app that you could only
see your Madoko-approved folder. But that's not -- Dropbox doesn't support it yet. So OneDrive
doesn't support anything like that yet. Because OneDrive also doesn't support sharing at this point. But
maybe in the future; right.
>>: Why couldn't you use the OneDrive folder? Just create an account that's only for Madoko and
share your folder with that account, and then that folder is what that account has access to, and -Dan Leijen: Sure. Yes. The same with Dropbox. You make your own account and then ->>: You have no idea but you only have access to what you want Madoko to have.
>>: Right. You can do that. The Madoko server doesn't do anything with this. I'm like a good guy.
[Laughter]
>>: And you've [indiscernible] secured code that we don't [indiscernible].
Dan Leijen: I hope so.
>>: Hey [indiscernible].
>>: So two more feature questions. So basically reviewing things like [indiscernible] elaboration,
where you do annotation and highlighted or whatever. And then the other one is revision history. How
do I see what's changed over time?
Dan Leijen: So, yeah, I would love to see like tracking of comments inside your documents. So I don't
know how or what would be the best way.
>>: There might be some commenting thing where I can put text in the Madoko that doesn't show up ->>: Oh, sure. Yeah, yeah.
>>: So I could use that for leaving notes for my co-authors.
Dan Leijen: Yeah. That's really easy to do. People do it all the time. Like maybe I'll sell that one.
Like often you see this kind of stuff. So this is what people do now. It works pretty well. For instance,
F Star. This is an F Star tutorial, and a whole bunch of people worked on that. And then there's a
bunch they made their own [indiscernible] notes. So here you see like NS is Nick Swami; right. So it's
a to-do block but in red, and will be with Nick, et cetera. Every time someone rights one of these to-do
blocks, it will pop up in the text and can you see it. That works well enough. I don't know if you see
any here. I think someone that don't write many.
>>: [Indiscernible].
Dan Leijen: So you want to show within the preview. You don't want to show it in the final output. So
the to-do block takes care of that.
>>: Okay.
Dan Leijen: And the other thing, what would be really great, is if you could somehow do revision
history still. So currently that's just not there. So there's two things can you do. One of them is you
can take snapshots and give it a message. So if you do a snapshot it saves the whole thing with a
message. So that's pretty good.
>>: Like the whole file or -Dan Leijen: Like everything needed to regenerate your documents.
>>: So the bit and -Dan Leijen: Everything that you did up to that point in time. So no bin. That's a good snapshot. You
do it before you publish or something.
>>: Yeah.
Dan Leijen: And then you can, of course, look in your Dropbox history to see every 30 seconds what
the document look like. And then if you integrate to GitHub, you see all these commits, like normally.
So then you get this -- then it's a regular GitHub works out. And I kind of like the more realtime
sharing on Dropbox, on OneDrive. Because you see everyone working. But then you lack this revision
history.
Yeah, if you have a great idea on how to do this, that would be great. And especially if we can
piggyback on existing technology.
>>: So just understanding. You must have an undue stack. Like I can hit Control Z and it will undo
edit. And that lives how long? Like until I refresh the browser page or something?
Dan Leijen: Yes. Well -- right. I'm changing it. It grew really big, the undue buffer. So I got into
trouble. Now indeed I clear it on refresh, but I want to change that. But, right, there is a limit to how
much you can undue. And it's always within one file; right? So often there's a whole bunch of files
and includes and you really want revisions of everything. So snapshot is best at this point.
Ben Zorn: So there's an online question. "What will happen if I open the existing LaTeX document in
Madoko." It's a question of how do you transfer -Dan Leijen: Right. So I just happen to have the menu open. It does have an import feature, which is
still in its initial stages, but it works quite well. So you can basically click on it and then import a
LaTeX document. And you will have to supply the first documents you have, and then drag and drop
in all of the includes that you have. And it works pretty well. But, of course, I didn't parse LaTeX
really. So it does a good effort job. It turns out that most of your commands are usually actually for
mathematics and not so much for like sections and small caps and that kind of stuff. So on most
document I tried up until now, it works pretty well.
>>: Stuff you can't translate, you leave as embedded LaTeX locks and the user can come in and -Dan Leijen: Yes. Right. And then so you see still all these commands and then can you fix them.
Yeah, I've just been trying this -- yeah, I can probably show it. On someone's dissertation. And, you
know, dissertations are very complicated documents. So I was surprised how well it -- oh, here
[indiscernible], that's more safe. So this is a document and it's converted automatically from a paper in
the Byte Group, Andrew Beagle. And it looks pretty good, right. So this is all automatic. But there's
very few funny stuff left out. Like here you see some funny stuff, like still an SI command, which I
don't translate. It is some package I don't know about. So there you would have to go in and do your
own stuff. But most of the things come out quite well.
Anyway, thanks a lot for your attention. I hope you're going to use it. Awesome. Thanks [Applause].
Download