librelist archives

« back to archive

Markdown lessons

Markdown lessons

From:
Dan Bernier
Date:
2011-10-22 @ 15:11
Ok, let's get this thing fixed!

So far, I see two options: build Redcarpet into Shoes, or use a
different Markdown parser.

I don't know much about Shoes internals, how hard it would be to build
Redcarpet into it, or what the consequences would be. It seems a shame
to bloat Shoes with Redcarpet just for this one use-case (well, we
could use it for the Shoes help). I'd love to hear more about this.

On to #2, using a different Markdown parser. Redcarpet is nice because
you can provide your own emitter, even though it's awkward to connect
the parsing events to the Shoes app (in retrospect, it would be easier
with an intermediate representation, like an AST). But I don't know
how many other Markdown parsers let you do that. We could emit HTML,
and then parse the HTML with something like Nokogiri, or we could try
to hack our own emitter into one of the Markdown parsers out there.
IAC, either approach will probably take a bit of time.

Building Redcarpet into Shoes would probably be fastest, in that none
(or very little) of the HH source would change, and I'm imagining you
can just bolt it on to Shoes. Changing the Markdown parser means no
Shoes changes, but probably sizable HH changes. Maybe we could add it
to Shoes for this release, and work towards a new Markdown parser for
the next...?

-- 
twitter @danbernier
http://wordcram.org

Re: [hacketyhack] Markdown lessons

From:
Steve Klabnik
Date:
2011-10-22 @ 17:13
> I don't know much about Shoes internals, how hard it would be to build
> Redcarpet into it, or what the consequences would be. It seems a shame
> to bloat Shoes with Redcarpet just for this one use-case (well, we
> could use it for the Shoes help). I'd love to hear more about this.

Well, Shoes exists to serve Hackety, for one. For two, we already
distribute certain cext gems because they'd be fun, and markdown would
be useful to a lot of people. We put gems here:
https://github.com/shoes/shoes/tree/develop/req and here:
https://github.com/ashbb/shoes/commit/a6048ab8b5d18652793e50bb1518bfeaa0eb0a1e
is an example of us adding chipmunk physics.

https://github.com/ashbb/shoes/commit/a6048ab8b5d18652793e50bb1518bfeaa0eb0a1e#L0R158
seems to be the relevant part.

> On to #2, using a different Markdown parser. Redcarpet is nice because
> you can provide your own emitter, even though it's awkward to connect
> the parsing events to the Shoes app (in retrospect, it would be easier
> with an intermediate representation, like an AST). But I don't know
> how many other Markdown parsers let you do that. We could emit HTML,
> and then parse the HTML with something like Nokogiri, or we could try
> to hack our own emitter into one of the Markdown parsers out there.
> IAC, either approach will probably take a bit of time.

Yeah, that sounds a bit extreme.

> Building Redcarpet into Shoes would probably be fastest, in that none
> (or very little) of the HH source would change, and I'm imagining you
> can just bolt it on to Shoes. Changing the Markdown parser means no
> Shoes changes, but probably sizable HH changes. Maybe we could add it
> to Shoes for this release, and work towards a new Markdown parser for
> the next...?

I vote just doing #1, and not #2.

Re: [hacketyhack] Markdown lessons

From:
Dan Bernier
Date:
2011-10-23 @ 16:17
On Sat, Oct 22, 2011 at 1:13 PM, Steve Klabnik <steve@steveklabnik.com> wrote:
>> I don't know much about Shoes internals, how hard it would be to build
>> Redcarpet into it, or what the consequences would be. It seems a shame
>> to bloat Shoes with Redcarpet just for this one use-case (well, we
>> could use it for the Shoes help). I'd love to hear more about this.
>
> Well, Shoes exists to serve Hackety, for one. For two, we already
> distribute certain cext gems because they'd be fun, and markdown would
> be useful to a lot of people. We put gems here:
> https://github.com/shoes/shoes/tree/develop/req and here:
> https://github.com/ashbb/shoes/commit/a6048ab8b5d18652793e50bb1518bfeaa0eb0a1e
> is an example of us adding chipmunk physics.
> 
https://github.com/ashbb/shoes/commit/a6048ab8b5d18652793e50bb1518bfeaa0eb0a1e#L0R158
> seems to be the relevant part.

Interesting. Ok, I'll try to get Redcarpet into Shoes today.