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

Provide an anchor/title mode #23

Open
tttp opened this issue Sep 24, 2011 · 4 comments
Open

Provide an anchor/title mode #23

tttp opened this issue Sep 24, 2011 · 4 comments

Comments

@tttp
Copy link

tttp commented Sep 24, 2011

sausage is expecting the html structured around sections

<div class="section">
content
</div>
<div class="section">
content
</div>

However in my case (and I suspect others), I wanted it to work around anchors

<h2>Section 1</h2>
content
<h2>Section 2</h2>
content

I wrote a simple that looks for h2, adds the needed wrapping div "sections" between the h2 and the next one and it works. Was wondering if the need is common enough to be put back in sausage?

X+

@gwern
Copy link

gwern commented Dec 16, 2011

tttp, any chance you could provide that code?

(I've been arguing with the author of my HTML generator, asking that the section divs be annotated with a class of some sort, so hopefully I won't need it - but I may fail.)

@christophercliff
Copy link
Owner

I had to do a similar thing for the CouchDB guide example, however I would consider this a markup problem outside the realm of this plugin.

@gwern you can see an example function in this commit: christophercliff/couchdb-guide@438d7d9#L0R318

@gwern
Copy link

gwern commented Dec 20, 2011

Thanks for the example; I managed to get the simpler example page working for gwern.net. It's pretty nice, all in all, although the shapes of the sausages indicates to me that it may not be working perfectly with all my heavily nested sections and subsections.

(BTW: "You're incouraged".)

@christophercliff
Copy link
Owner

After some consideration, I'm reopening this. Came to my attention that one of the more valid use cases for this would be lengthy blog posts with many sections. Authors writing in Markdown most likely won't have the knowledge or desire to overhaul their pages to accommodate the sausage.js markup requirements.

So the question is, how can this be accomplished without savaging the DOM?

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