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

Giving a header an ID #306

Closed
IngwiePhoenix opened this issue Apr 2, 2015 · 8 comments
Closed

Giving a header an ID #306

IngwiePhoenix opened this issue Apr 2, 2015 · 8 comments

Comments

@IngwiePhoenix
Copy link

Hey.

Will Parsedown ever support

# Heading {#some-id}

or similar?

Kind regards, Ingwie.

@hkdobrev
Copy link
Contributor

hkdobrev commented Apr 2, 2015

@IngwiePhoenix This is a feature from Markdown Extra which Parsedown Extra supports.

@IngwiePhoenix
Copy link
Author

Is it the same API? Or do I need to change anything in my code to use Parsedown Extra?

On Do. Apr. 02 2015 18:22:31 Haralan Dobrev wrote:

@IngwiePhoenix https://github.com/IngwiePhoenix This is a feature from Markdown Extra https://michelf.ca/projects/php-markdown/extra/#spe-attr which Parsedown Extra https://github.com/erusev/parsedown-extra supports.


Reply to this email directly or view it on GitHub #306 (comment).

@hkdobrev
Copy link
Contributor

hkdobrev commented Apr 2, 2015

@IngwiePhoenix It's the same. It's just a simple extension of the Parsedown class. You just need to include the ParsedownExtra.php file (or if you are using Composer, just composer require erusev/parsedown-extra) and make an instance of the ParsedownExtra class.

@IngwiePhoenix
Copy link
Author

Awesome. I just changed to ParsedownExtra on my project and its awesome. :) Thanks!

On Do. Apr. 02 2015 18:37:13 Haralan Dobrev wrote:

@IngwiePhoenix https://github.com/IngwiePhoenix It's the same. It's just a simple extension of the Parsedown class. You just need to include the ParsedownExtra.php file (or if you are using Composer, just composer require erusev/parsedown-extra) and make an instance of the ParsedownExtra class.


Reply to this email directly or view it on GitHub #306 (comment).

@aidantwoods
Copy link
Collaborator

Closing since the extension fills this role

@sbrl
Copy link

sbrl commented Mar 31, 2018

Is it possible to add ids automagically with ParsedownExtra?

@cossssmin
Copy link

@sbrl What would the automagically-added ID look like? Consider this heading:

# I'm not (exactly) sure how to create/build my own ID

Yeah, it could manipulate the string into some sort of slug, but how could ParsedownExtra know what kind of 'slug' you want, or how long the text of the ID should be?

For example, maybe you want it to output:

<h1 id="im-not-exactly-sure-how-to-create-build-my-own-id">I'm not (exactly) sure how to create/build my own ID</h1>

OK. Then again, maybe someone would prefer underscores:

<h1 id="im_not_exactly_sure_how_to_create_build_my_own_id">I'm not (exactly) sure how to create/build my own ID</h1>

Surely, for long text, everyone would like short IDs, maybe something like:

<h1 id="create-build-own-id">I'm not (exactly) sure how to create/build my own ID</h1>

That's why this belongs to userland. Either create an extension that 'slugifies' the text as you need it, or just use ParsedownExtra as intended:

# I'm not (exactly) sure how to create/build my own ID {#custom-id}

@sharpicx
Copy link

image

image

are u sure if this {#id} in the ParsedownExtra.php? seems like the id isnt rendered anymore

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

No branches or pull requests

6 participants