Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chained scrollbars #4

Open
ondrejsika opened this issue Jul 31, 2013 · 6 comments
Open

chained scrollbars #4

ondrejsika opened this issue Jul 31, 2013 · 6 comments

Comments

@ondrejsika
Copy link

Hi,
this is the best markdown editor, that i view. i have only one comment. is it possible chain scrollbars for automatic move preview down if i write?

thanks
Ondrej Sika

@jbt
Copy link
Owner

jbt commented Jul 31, 2013

👍 this is something I'd really like to do but I haven't yet figured out exactly the best way to do it yet. Definitely on the todo list though

@ghost
Copy link

ghost commented Feb 5, 2014

Idea:

  • give all block level elements an id, like a uuid or something
  • associate block elements to a markdown line plus any non-block element lines that follow.

That gets you a height in lines to scroll on the code editor, to a height of the block element on the rendered pane.

I don't know what to do from there. This is a really complex feature.

This was referenced Apr 12, 2014
@carbontwelve
Copy link

I was attempting to do this yesterday, although each implementation I tried didn't quite work right. I have seen chained scroll-bars elsewhere so may have a go at reverse engineering how they went about it to learn how it can be done here.

@jbt
Copy link
Owner

jbt commented May 27, 2015

The simplest and most naïve way of implementing chaining would just be to link the %age scroll depth between the two views. Problem is that can go wrong when the markdown input is particularly smaller or larger than the output (eg a large image only takes up one line of input, but could be several hundred px high in the output).

The way some editors achieve it is to break the markdown into sections, but I haven't yet figured out a foolproof way to do this that wouldn't completely break in some scenarios (you can't go and stick <span> elements into the output anywhere you like - you have to be sure that you're putting them somewhere that won't affect the output).

Totally open to pull requests if someone cleverer than me can figure it out. Otherwise I'll carry on experimenting but I can't promise when I'll be able to get it to work.

Actually thinking about it, it might be possible to do something now that I've switched from marked to markdown-it, because it does give some information about source line numbers, and then could try and implement the solution suggested above...

@ghost
Copy link

ghost commented May 28, 2015

I ask that chained scrollbars be toggleable, just in case that wan't thought of

@jbt
Copy link
Owner

jbt commented May 28, 2015

Yeah good shout - I think that however they're implemented there's always scenarios where it'll be annoying, so definitely having a way to turn it off is a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants