-
Notifications
You must be signed in to change notification settings - Fork 530
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
Header offset setting #119
Conversation
…example if you have a page title then the markdown content after.
I think I should have made a new branch and committed it to that instead... first pull request, sorry! |
I'm not at all convinced this should be part of the Markdown parser. There's no need for it to be there. You can achieve the same perfectly well with a second filter like this one:
It also has the advantage that i'll continue to work if you switch to another parser or text format. |
I should think it would be a common enough use case to be explicitly supported, and the workaround seems a bit hacky to me, but I'll go with it. Thank you for suggesting the code. |
I think it should be supported. I made almost identical modification to this script few months ago. It is needed. It may be more common case (part of page) than creating whole page this way. |
Maybe a way of adding html |
As an option it would be great, but is there anybody, who want to write it? I bet this modification will take more than 3 lines, which is what |
What do you mean @jjok? |
@stewartml Heading tags work differently in HTML5 from previous versions. Have a look at these: http://www.w3.org/TR/2011/WD-html5-author-20110809/the-h1-h2-h3-h4-h5-and-h6-elements.html Actually, if you just rendered your article inside an |
That's right. Didn't think about it. But still HTML5 is working draft and we should consider this in HTML4.01, so |
@jjok Ah, right. I already render the article inside an article tag, but the article title isn't in the markdown content, and is inside the article tag. Chucking the article title inside a header tag could work though, and to be honest there's no real reason why my blog engine has to ask for a separate title anyway. On reflection, there probably isn't actually a need for this feature, as translated markdown could always be written into section elements or whatever by the page that outputs them. @Arrvi I think it's safe to use HTML5... |
@stewartml If you've got your code so it's:
... then you should be fine. |
For my own blog I'm using the |
@Arrvi "working draft" is meaningless. HTML5 is usable right now across the board. And is fully backward compatible. An old browser doesn't stop working if you're using HTML5. In this scenario I'm with @jjok, but I'd like to see more HTML5 support across the board. You don't necessarily need the article element or anything, but things like section and even more so figure would be nice to have. |
@Arrvi +1 |
@michelf I changed your function to use |
@lukasoppermann It's a function that takes HTML as input and returns transformed HTML as output, hence why I'm calling it a filter (usage of that term is debatable). The function itself has nothing to do with PHP Markdown. |
I'm writing a page which displays articles and consists of a page title as H1, and then the article content translated from markdown. I'd like to be able to start the header numbering of the content at H2, so I've made this fork. This is related to #102, but I prefer my implementation. There is an open issue for this feature here: #117