pastly / bm

Blog Maker - Build a blog with bash, make, and other GNU shell utilities. Ongoing development has essentially stopped.
Other
21 stars 3 forks source link

{toc} seems to be broken #7

Open aadibajpai opened 5 years ago

aadibajpai commented 5 years ago

image

Output of meta//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 commented 5 years ago

Can't look into it right this minute, but can you share the .bm source too? At least a paragraph or two before and after the {toc}

I've had problems with it too. But never tried very hard to fix.

On July 14, 2019 8:54:40 PM GMT+02:00, Aadi Bajpai notifications@github.com wrote:

[image]https://user-images.githubusercontent.com/27063113/61188002-a381aa80-a696-11e9-8fee-9e17e4d0279c.png

Output of meta//toc

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/pastly/bm/issues/7?email_source=notifications&email_token=ACIY3NSKR56NX3B4PQIGIO3P7NY7BA5CNFSM4IDRWQ32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7DFLXA, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACIY3NVCWX3LIEOBPO3ASZTP7NY7BANCNFSM4IDRWQ3Q.

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

aadibajpai commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Yeah, that should work. image