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

{toc} seems to be broken #7

Open
aadibajpai opened this issue Jul 14, 2019 · 6 comments
Open

{toc} seems to be broken #7

aadibajpai opened this issue Jul 14, 2019 · 6 comments

Comments

@aadibajpai
Copy link
Contributor

image

Output of meta/<post_id>/toc

- <a href='#1-choose-your'>1. Choose your org early.</a>
- <a href='#2-get-acquainted'>2. Get acquainted with how version control works.</a>
- <a href='#3-quality-over'>3. Quality over quantity would be the way to go except...</a>
- <a href='#4-try-to'>4. Try to make life easier for your org.</a>
- <a href='#5-don’t-restrict'>5. Don’t restrict yourself to tasks.</a>
- <a href='#6-try-to'>6. Try to get really involved.</a>
- <a href='#7-last-but'>7. Last but not the least, be nice be respectful.</a>
- <a href='#useful-links'>Useful Links-</a>
@pastly
Copy link
Owner

pastly commented Jul 14, 2019 via email

@aadibajpai
Copy link
Contributor Author

No problems,

Let’s say you don’t want to settle for a t-shirt and are willing to focus on GCI neglecting sleep/studies/social life/whatever. In that case, read on, we’re jumping to the meat of it now. (I’m presuming you know the basics about the contest.)

{toc}

You need to understand there’s no specific skill set that will help you win GCI, there’s no sure bet that being very proficient in *insert language* will make sure you win. That’s not how it works, which brings us to the first pro tip-

### 1. Choose your org early.

Every organization has specific languages and tools they use. The org I worked with, [CCExtractor Development](http://ccextractor.org), has its core utility mainly written in C, while the [sample-platform](https://github.com/CCExtractor/sample-platform) is in Python. So skim through the orgs once they’re official and see which one suits you best. It wouldn’t hurt checking out previous orgs either, since many of them may participate again. That would in fact give you an advantage over others. This point applies for GSoC as well.

@pastly
Copy link
Owner

pastly commented Jul 14, 2019

Alright think I figured it out. This is notes for myself, but will include a work around for you that you may or may not like.

The TOC generating function ...

  1. parses the post with markdown
  2. looks for h1, h2, h3, etc. tags
  3. turns the tags into unordered list items with extra leading spaces corresponding to the h-level

(among other complexity I don't remember the purpose for at this time)

When you don't start with a '# foo' but start with '### foo', that's an h3 tag not h1, which means the markdown will see:

      - foo
      - bar

which it interprets as a block of code. But if the tree of headings was properly started with an h1 with h2 children (with h3 children [with h4 children ...]), it should be parsed by markdown as lists of lists of lists as intended.

So there's the problem, I think. The fix is ... to fix that. Somehow. I'll think about it more when I can.

The workaround is to use h1 headings (a single '#') as """intended""" and to use CSS to make them smaller if you don't like how big they are. I'm guessing their size is why you added '#' chars. You could also try:


this is the last line of the previous paragaph. It was a good paragraph. The best.

**Section 2: Electric Boogaloo**

Now it's time to talk about nuclear and my MIT uncle. Best jeans. People are saying, let me tell you.

(bolding a line by itself as "headings")

@aadibajpai
Copy link
Contributor Author

That makes sense, and yes, I used h3 because of the size. I think the fix would be to calculate the number of spaces relative to the tags accrued. That is, the relative hierarchy should be taken into accord, the place value instead of the face value. I'd try but my shell scripts are wonky at best.

I actually was using bold text previously but replaced them since I figured they wouldn't be parsed by the toc generator.

@pastly
Copy link
Owner

pastly commented Jul 14, 2019

I actually was using bold text previously but replaced them since I figured they wouldn't be parsed by the toc generator.

Oh ... yeah. Of course. They wouldn't.

I think the fix would be to calculate the number of spaces relative to the tags accrued

Seems promising. What would you expect to happen with:


### foo

asdf

# bar

asdf

Actually, while nonsensical, the following HTML renders reasonably in Chrome and Firefox.

<ul>
        <ul>
                <ul>
                        <li>asdf</li>
                </ul>
        </ul>
        <li>fdas</li>
</ul>

Maybe the fix won't be so hard ........

@aadibajpai
Copy link
Contributor Author

Yeah, that should work.
image

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

2 participants