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

Anchor points to "jump to" div #49

Closed
lakhman opened this issue Feb 26, 2014 · 8 comments
Closed

Anchor points to "jump to" div #49

lakhman opened this issue Feb 26, 2014 · 8 comments

Comments

@lakhman
Copy link

lakhman commented Feb 26, 2014

I was trying to achieve the following:

http://stackoverflow.com/a/7335259/711308

I should be able to write something like:

## Table of Contents

1. [Introduction](#intro)
2. [boobies](#boobies)
3. [pookie](#pookie)

---

## <a name="intro"></a>Introduction
This is the introduction text

<div style="height: 500px;"></div> <!-- Spacer -->

## <a name="boobies"></a>Boobies
This is the booby text :)

<div style="height: 500px;"></div> <!-- Spacer -->

## <a name="pookie"></a>Pookie
This is the pookie text :)

On click of the 'Table of contents' links, I should be able to jump to the named div, but this does not seem to work. I think it works on the first click (although it doesn't take you to the correct div), and after the first click, nothing happens.

This is a great feature of markdown, and would be so useful for creating documentation (which is what I would like it for).

You can use a div with an id (in plain HTML) to achieve the same thing, but this defeats the point of markdown (and the plugin), as you cannot use markdown within the div (So I would have to HTML code everything within the div, and then its not Markdown anymore, but its plain HTML!).

Any ideas of a fix or workaround to work in flow-netbeans-markdown? (Can I use any other markdown syntax to achieve the same thing?)

Thanks

@stengerh
Copy link
Collaborator

Features don't exist until someone implements them. ;) In this case the missing feature is navigation in the editor using hyperlinks within the document. There is no work-around or alternative syntax to achieve this with this plugin so far.

@lakhman
Copy link
Author

lakhman commented Feb 26, 2014

ok sweet, no probs, I thought it might have been implemented within the "markdown" library if one was implemented, I guess I might have to take a look at this myself if I can!

Thanks for the confirmation!

@lakhman lakhman closed this as completed Feb 26, 2014
@stengerh
Copy link
Collaborator

We use pegdown internally, both to transform Markdown to HTML and to generate an AST which is used for the various editor features (syntax highlighting, navigator window, etc.). Unfortunately embedded HTML elements are represented as merely that, either inline or block HTML elements. There is no special treatment for hyperlinks or anchors in pegdown.

@madflow
Copy link
Owner

madflow commented Feb 26, 2014

There is a feature request for automatically inserting an id attribute when using headings:

sirthias/pegdown#110. This could do the trick.

This is already an Extension for example in this Python Markdown library:

https://github.com/trentm/python-markdown2

@lakhman
Copy link
Author

lakhman commented Feb 26, 2014

would it be possible to implement the python library (or even an other more full featured library),
I don't really code in java, so just an idea?! :)

@lakhman
Copy link
Author

lakhman commented Feb 26, 2014

would it be possible to implement the python library (or even an other more full featured library),
I don't really code in java, so just an idea?!

I've just realised this is only in the netbeans editor pane, the exported HTML works fine, and this is not as big of a issue I thought i might be, it seems the markdown convert does allow you to jump to "names".

So if you write markdown like:

1. [Introduction](#intro)

## <a name="intro"></a>Jump to anchor

Its transformed into:

<a href="#intro">Introduction</a>

<h2><a name="intro"></a>Jump to anchor</h2>

This works fine in browsers, and fine for a little workaround, You can just regenerate the file and view it, its only within the editor preview pane that this issue exists.

@stengerh
Copy link
Collaborator

Okay, I initially thought you were talking about the source pane in the editor. These links should work in the exported HTML when viewed in a web browser. They should or could also work in the JavaFX based preview for NetBeans 8.

@lakhman
Copy link
Author

lakhman commented Feb 27, 2014

Great thanks, I'll have to give V8 a try, I take it the plugin is 100% compatible with Netbeans V8?

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