what i meant by "simple"
bowerbird at aol.com
Wed Aug 27 20:48:24 EDT 2014
# what i meant by "simple"
## table of contents
what i meant by "simple"
table of contents
about the message i posted
what gerald said
what john said
what i mean by "simple"
my general responses
my code was also less than perfect
and now no framework required
what this code facilitates
on the matter of doing sync
determining the line the cursor is on
## about the message i posted
first let's look at what people said about my post.
### what gerald said
> I published a simple single static HTML page
> side-by-side markdown editor about a year ago.
### what john said
> the dingus I linked to before
> has side-by-side editing
## what i mean by "simple"
i realize that i neglected to mention my operationalization for
the word "simple" in the context of that sample code i posted.
my goal was to demonstrate that an .html file -- by itself --
is sufficient. the absence of any "framework" is thus crucial.
most people prefer to use the framework of _their_ choice.
### my general responses
gerald, your code will be "simple" in a ruby-on-rails setting.
but anyone who doesn't know ruby-on-rails is gonna be lost.
and john, your dingus has a lot of bootstrap dependencies.
### my code was also less than perfect
of course, as i noted, the code i posted required jquery, so
it wasn't completely "pure" in terms of my now-stated goal.
so, as an exercise, i reworked the example just a little bit:
### and now no framework required
you can verify this new code requires no framework at all.
in a "real" editor, there are enough wrinkles that jquery is
more-or-less a requirement anyway, but this is an exercise.
i also hand-coded a very crude conversion routine, so that
there is no need to call a converter from the internet either.
the conversion routine is embedded right there in the page.
### what this code facilitates
this allows a person to download the light-markup text itself,
and have it converted to .html _client-side_ for display there.
it also allows the .html file to be used in an "offline" context,
provided that you grok the resultant complications of "saving".
but the cool thing is client-side conversion of the light-markup.
in this sense, similar rad stuff has been done by "strapdown":
for the strapdown version of this message, see here:
## on the matter of doing sync
> It should be possible to add some degree of syncing,
> since the stmd parser includes source position information
> in the syntax tree, and this could (with some changes
> to the HTML writer) be included in the HTML output
one could enable syncing in that way, most definitely.
i do it another way, but whatever works is worthwhile.
### determining the line the cursor is on
> I never did figure out how to determine using js
> which line of the input source the cursor is on,
> but presumably this is possible.
1. get location of the editfield cursor.
1. get copy of text up to the location.
1. put the copy in a dummy textarea.
1. use dummy height to compute line.
More information about the Markdown-Discuss