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

Automatically generate IDs for code examples #26

Open
hagenburger opened this issue Aug 18, 2018 · 3 comments
Open

Automatically generate IDs for code examples #26

hagenburger opened this issue Aug 18, 2018 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers RGSoC This is a task for the Rails Girls Summer of Code DV Team
Milestone

Comments

@hagenburger
Copy link
Owner

New feature

Code examples should get an automatically generated HTML ID if not defined by the user.

Specification

``` html #my-id
<p>Lorem ipsum</p>
```

Already gets the ID my-id when the ID plugin is used:

<div class="pimd-example" id="my-id">
...

When no ID is defined:

``` html
<p>Lorem ipsum</p>
```

It should get an automatically generated ID:

<div class="pimd-example" id="example-f2d69d">
...

Open questions

  • How to generate the ID? Maybe generate a hash of the contents
  • How long should the ID be? Maybe 6 hex characters should be enough
@hagenburger hagenburger added enhancement New feature or request good first issue Good for newcomers RGSoC This is a task for the Rails Girls Summer of Code DV Team labels Aug 18, 2018
@hagenburger hagenburger added this to the v1.0.0 milestone Aug 18, 2018
@12finger
Copy link

  • How to generate the ID? Maybe generate a hash of the contents

I agree, would be nice to get this working!

  • How long should the ID be? Maybe 6 hex characters should be enough

as inspiration i would start looking into the code of css-modules as they do similar things with their classes.
along these lines?

example:
https://www.javascriptstuff.com/css-modules-by-example/

see:
css modules by example 2018-08-21 14-06-38

@hagenburger
Copy link
Owner Author

@12finger yes, go with it as suggested.

@artnerdnet
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers RGSoC This is a task for the Rails Girls Summer of Code DV Team
Projects
None yet
Development

No branches or pull requests

3 participants