frostming / marko

A markdown parser with high extensibility.

Home Page:https://marko-py.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

marko.convert() index error

sisygoboom opened this issue · comments

Hi, I'd like to make you aware of a bug in the marko.convert function. It triggers the following error:


  File "<ipython-input-3-0560f851ca97>", line 1, in <module>
    marko.convert("""Musashi is an outstanding novel that I'd recommend to anyone. I recently [finished reading it](https://noeldemartin.com/tasks/reading-musashi-by-eiji-yoshikawa), and after reviewing the notes I took and mulling over them, I've decided to publish them here.

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\__init__.py", line 136, in convert
    return _markdown.convert(text)

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\__init__.py", line 103, in convert
    return self.render(self.parse(text))

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\__init__.py", line 114, in parse
    return self.parser.parse(text)

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\parser.py", line 70, in parse
    return self.block_elements["Document"](source_or_text)  # type: ignore

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\block.py", line 90, in __init__
    self.parse_inline()

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\block.py", line 72, in parse_inline
    child.parse_inline()

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\block.py", line 72, in parse_inline
    child.parse_inline()

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\block.py", line 68, in parse_inline
    self.children = parser.parse_inline(self.children)  # type: ignore

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\parser.py", line 99, in parse_inline
    return inline_parser.parse(

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\inline_parser.py", line 30, in parse
    for match in etype.find(text):

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\inline.py", line 107, in find
    return inline_parser.find_links_or_emphs(text, _root_node)  # type: ignore

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\inline_parser.py", line 168, in find_links_or_emphs
    node = look_for_image_or_link(text, delimiters, i, root_node, matches)

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\inline_parser.py", line 196, in look_for_image_or_link
    match = _expect_inline_link(text, close + 1) or _expect_reference_link(

  File "C:\Users\chris\anaconda3\envs\hat-ai\lib\site-packages\marko\inline_parser.py", line 236, in _expect_inline_link
    if text[i] == "<":

IndexError: string index out of range

The markdown to reproduce this bug can be found below


This isn't a book summary, it's a Lessons Learned summary. Don't be afraid to keep reading if you plan to read the book, this will be spoiler-free. I will include quotes from the book, and I hope they serve as motivation for you to actually read it. If you already have, I invite you to let me know what you learned and how that compares with my takeaways.

## About The Book

![Miyamoto Musashi](https://cdn.steemitimages.com/DQmUxgQ8jBCMiRg95ot3ADV97QgUWApJcyDRyTb39XhakMj/Musashi.jpg)
*Depiction of [Miyamoto Musashi](https://en.wikipedia.org/wiki/Miyamoto_Musashi)*

Musashi is a japanese novel written in 1953 by Eiji Yoshikawa. It relates the journey of Miyamoto Musashi, a real-life samurai from the 1600s who decided to follow the Way of the Sword. It's an interesting novel because some of the events related in the book are documented to have happened in real life. I'm not sure how much of the book is real or fiction, but I don't think it matters. Some works remain written by the real Miyamoto Musashi, the most famous of which is The Book of Five Rings.

In essence, this book relates the journey of a man who dedicates his life to self-improvement and self-discipline, and how he reaches enlightenment.

I know, "enlightenment", that's one of those words that can have thousands of connotations. What it means to me is reaching a state of mental clarity and calmness. Nothing less, nothing more. I think of this as an ideal to strive for, and not as something that can be grasped.

------

Without further ado, let's get into what I learned reading Musashi.

## The Path and The Way

One of the most prominent ideas mentioned throughout the book is the Path and the Way. We are all walking our own path, and it is our actions that lead us to the place we want to reach. Continuous learning and self-discipline will get us where we want, only if we follow the Path.

This can feel like an abstract concept to understand, but after reading the book I get what it means. It makes a lot of sense for how I see the world and my life. This quote from the book encompasses its meaning:

>
> He well knew that to live was more than merely to survive. The problem was how to imbue his life with meaning.
>

For Musashi, meaning comes from being a samurai. Early in the book he decides to follow the Way of the Sword:

>
> To Musashi's way of thinking, there was one way of life for ordinary people, another for the warrior. It was vitally important for him to live like a samurai and to die like one.
>

Don't be discouraged if you don't know what's your path. I'm not sure I'd be able to put mine in words, but I know I'm on it. I know because I make progress every day and I am satisfied with my life. There is always room for improvement, but that's ok. It's part of the Path to never reach its end.

You shouldn't evaluate whether you're on the Path or not by looking at your current situation. And your circumstances don't matter either. Being on the Path means walking on the right direction, doing what you know you need to do. And it's a long journey. Temporal digressions don't make a difference as long as the overall direction is correct.

This passage comes from another important character in the book, Takuan. He explains how different paths are in reality the same:

>
> People talk about combining the Way of Learning with the Way of the Samurai, but when properly combined, they aren't two—they're one. Only one Way.
>

You should be looking for your own path and what brings meaning to your life.

And it doesn't have to stay the same. Musashi's opinion of his path evolves throughout his journey:

>
> He had come to see the Way of the Sword in a new light. [...] To cut people down, to triumph over them, to display the limits of one's strength, seemed increasingly vain. He wanted to conquer himself, to make life itself submit to him, to cause people to live rather than die.
>

## The Limits We Set for Ourselves

In Musashi's time, status and position were very important. Part of which came from family bloodline. That's why it's surprising that him, who's got no prominent relatives, becomes increasingly uninterested with the idea of obtaining status.

Here's a description of what a rōnin (a samurai without a master) should be:

>
> A true rōnin did not seek fame or profit, did not curry favor with the powerful, did not attempt to use political power for his own ends, did not exempt himself from moral judgments. Rather he was as broad-minded as floating clouds, as quick to act as the rain and quite content in the midst of poverty. He never set himself any targets and never harbored any grudges.
>

Society imposes judgement and limitations upon us. Some are unintended, and some are self-imposed. It's important to understand those and define our own standards.

We must reassess our perspective frequently and not make any assumptions. Musashi is well aware of his shortcomings, and he's constantly evaluating his knowledge and how far he's from reaching his goals:

>
> I'm afraid I'm still immature, imprudent—far from being truly enlightened. The more I travel, the longer the road becomes. I have the feeling I'm climbing an endless mountain path.
>

And this also needs to be applied when things are going our way. Don't sit complacent when you get someone else's seal of approval. One of the things I admire the most about Musashi is his humbleness and how he responds to undeserved praise:

>
> Don't embarrass me. I'm still an amateur. But the world's full of people who don't seem to be as good as I am.
>

That's why the Path is a journey of constant learning. To me, learning is one of the fundamentals of life.

Another fundamental is the Self.

## The Self and Looking Within

We get wrapped up in external stimuli, and we end up with a skewed view of reality.

We mustn't forget that we are the center of our life, and I don't mean it in a selfish way. Helping others is one of the best things you can do for yourself.

Here's another gem uttered by Takuan:

>
> One's self is the basis of everything. Every action is a manifestation of the self. A person who doesn't know himself can do nothing for others.
>

Something that can lead us astray from looking within is envy or aspiring to be like someone else. It's always good to have someone to look up to, having goals and ideals is what helps you make progress. But don't lie to yourself thinking that anyone is perfect. At the end, we're all going through the same struggles:

>
> Whether people were great or not, there was not much variety in their inner life experience. Any difference lay merely in how they dealt with common human weaknesses.
>

Which ties neatly into this other quote:

>
> It is easy to crush an enemy outside oneself but impossible to defeat an enemy within.
>

What it comes down to is being comfortable in your own skin. Musashi spends a good deal of time alone. And it's in those moments of introspection where he feels the most alive.

>
> Counting his footsteps, listening to the silent voice of the heavens above, he could forget everything and rejoice in his own being. When he was surrounded by crowds of busy people, his spirit often seemed sad and isolated, but now he felt alive and buoyant.
>

## The Value of Experience

This has been introspective and abstract so far. But this book relates a samurai's journey, so there is a good deal of action.

It's good to reflect and ponder, but it's also necessary to put thoughts into practice.

>
> The truth of the scholar, alone in his study, does not always accord with what the world at large considers to be true.
>

Growing consists of a cycle of thinking and doing. And none can be fully effective without the other.

>
> The knowledge that comes from books is of no use to the warrior, if a man worries too much about what others think or do, he's apt to be slow to act.
>

This is not only for the sake of our physical existence. The world of ideas is intangible, and our minds need to be fed with experiences to thrive. A feedback loop between our experiences and our thoughts is necessary for growth.

>
> Only those who had actually grown their own grain and vegetables really understood how sacred and valuable they were. Those who hadn't were like priests who did not practice what they preached or swordsmen who learned combat techniques but knew nothing of the Way.
>

This leads us to reevaluate our view on obstacles and adversity.

## A Different Look on Hardships

This is one prayer that Musashi makes in a temple on his journey:

>
> Please test the lowly Musashi with hardship. Let him become the greatest swordsman in the land, or let him die.
>

Quite extreme, but gets the point across. The fact is that going through difficult situations is essential to reevaluating our assumptions and getting outside our comfort zone. You should not necessarily see them as bad or something to avert.

If something scares you, analyze objectively if it's worth doing. And most of the times, it will. Fear often comes from inexperience and lack of knowledge. By facing our fears we can expand our self where we need it the most.

The path that Musashi chose tested him constantly on this regard:

>
> Any person who followed the Way of the Sword was constantly in danger of being killed. [...] Danger was the grindstone on which the swordsman whetted his spirit. Enemies were teachers in disguise.
>

In those situations, it's difficult to remain calm and absorb all the lessons. But we need to take control and get a handle on our emotions. We need to learn how to detach and make objective judgement.

The ability of detaching from a situation doesn't come naturally, specially from high-pressure situations. It may even be contrary to our nature. But it isn't something that cannot be tamed:

>
> While custom was bred by daily experience, being on the boundary between life and death was something that occurred only a few times during a lifetime. Yet the ultimate aim of the Way of the Sword was to be able to stand on the brink of death at any time: facing death squarely, unflinchingly, should be as familiar as all other daily experiences. And the process had to be a conscious one, though movement should be as free as if it were purely reflexive.
>

Granted, we don't have to be as extreme as him. But that's because we're not on the Way of the Sword. So find the equivalent for your Way, and do it. By exposing yourself to those environments you'll absorb all the stimuli and improve drastically.

But don't limit your experiences only to what you consider your Way.

>
> Fighting isn't all there is to the Art of War. [...] A serious student is much more concerned with training his mind and disciplining his spirit than with developing martial skills. [...] He wants, essentially, to go everywhere he can and learn everything he can.
>

Go everywhere you can and learn everything you can.

## Being One With The Universe

I have talked about the importance of both mind and body. And this is something that's expressed throughout the book as being one with the universe. It encompasses everything: our inner experiences, our outter experiences and everything around us.

>
> I've also spent some time traveling about the country side, learning from the mountains and the rivers. I regard them, too, as teachers.
>

Be in contact with your environment and become a spectator to your life. Looking at the true essence of the world will allow you to move freely. But don't try to bend it to your will.

>
> Do not attempt to oppose the way of the universe. But first make sure you know the way of the universe.
>

Things are what they are, there's no point in complaining about things we can't control. The sooner we realize that, the sooner we'll start walking the Path.

------

I feel like I've only scratched the surface and there are many ideas I didn't get into. If you found this useful, I commend you to read the book for yourself. It'll be a journey you won't regret.

And don't let all of this get to your head. At its core, life is simple:

>
> The Buddha's Law is simple: Eat your rice, drink your tea, wear your clothes.
>
![image.png](https://files.steempeak.com/file/steempeak/naturalmedicine/FJprpQxF-image.png)

Greetings! Welcome to the @naturalmedicine weekly curation. This week we share stories of tree magic, turmeric goodness, listening to our bodies and ultra cool permaculture playing cards. 

Grab yourself a nourishing drink and snuggle up because you're in for some wonderful stories brought to you by the members of @naturalmedicine. 

![download1.png](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

In case you were wondering how we choose posts to be featured in these curations, we favour:

- original articles
- a blend of personal stories and facts/research (either anecdotal or otherwise) to engage the reader
good images or photos
- novel or interesting approaches to self care through natural remedies
- content that makes us go aaaaaaaaahhhhh

If you'd like help making your posts pop, please let us know - we're here to help you succeed!

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

# <center> This Week in Natural Medicine </center>

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

@walkerland here - I think it is mighty time that we began the weekly curation by featuring a piece written by @riverflows don't you? Also known as the cool cat founder of Natural Medicine, she is a masterful weaver of words, magical storyteller and a full out beautiful human. You can [fall into her words here](https://steemit.com/naturalmedicine/@riverflows/blackthorn-dreaming-of-darkness-tree-magic-and-witches). 

# Blackthorn Dreaming: Of Darkness, Tree Magic, and Witches
by @ riverflows

> On the white painted shelves in my man's truck sat books from Dostoyesky to Buddhist Cosmology, wisdoms of the Dalai Llama to the Koran, guides to mushrooms and toadstools and everything in between. And so it was that I found a thin green book called 'The Sacred Tree' by Glennie Kindred, and learnt of the tree ogham, where each tree had its own celtic name which linked it to a letter of the ogham alphabet, used before the introduction of the Latin A.B.C's. The book seemed a promise to me, a way of connecting to landscape. There were stories everywhere, once I started listening. I would sit around campfires where people would say not to burn elder, for witches had been known to turn themselves into elder trees and to burn a witch you'd be cursed indeed. [[Read More]](https://steemit.com/naturalmedicine/@riverflows/blackthorn-dreaming-of-darkness-tree-magic-and-witches)

![R18Mkw4qimage.png](https://files.steempeak.com/file/steempeak/naturalmedicine/KNSkZ6Ud-R18Mkw4q-image.png)

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

# Beyond Symptoms - The Natural Medicine of Fatigue 
by @artemislives

With busy hustle and bustle of life, fatigue can hit us all. This perfectly timed post provides an enlightened lesson into listening to our bodies and managing fatigue. The solution might not be one that you'd expect. [Read it here](https://steemit.com/naturalmedicine/@artemislives/beyond-symptoms-the-natural-medicine-of-fatigue)! 

> He rolled onto me just before dawn, like a languid, overweight lover, and I found it oddly comforting. I managed to weasel out from under him just enough to be able to breathe, and then fell back into a profound and deep sleep. When I woke some hours later with bright Sunday sunshine streaming across the bed, it was a different story. I felt suffocated, heavy and unable to move. Frustrated. He sprawled there across me, outstaying his welcome and crushing me and my to-do lists, my plans and my hopes for the day. [[Read More]](https://steemit.com/naturalmedicine/@artemislives/beyond-symptoms-the-natural-medicine-of-fatigue)

![jAnw0Hu4nature845849_1920.jpg](https://files.steempeak.com/file/steempeak/naturalmedicine/ZKW3LJTZ-jAnw0Hu4-nature-845849_1920.jpg)

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

# One With Nature
by @zyx066

As the season of overindulgence and consumerism nears, @zyx066 takes an important step back by exploring our disconnect with nature and indifference towards life. This post weaves through this complex topic offering threads of hope while reminding us all of our interdependence with nature. 

> We are highly evolved people; I'm sitting here behind a keyboard writing today's article, and you're going to be reading it on a high definition screen, both powered by a seemingly ubiquitous electrical grid. We've even reversed the rules of evolution and no longer adapt to our surroundings, but have conquered all surroundings with science and technology, and adapt them to our needs.[[Read More]](

![one_with_nature.jpg](https://files.steempeak.com/file/steempeak/naturalmedicine/y1WVmc92-one_with_nature.jpg)

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

# Making Turmeric powder and starch at home 
by @quochuy 

@quochuy grows his own turmeric! In this post he teaches us how easy and rewarding it is to make turmeric powder using fresh turmeric root. [Get the direction here](https://steemit.com/growyourownfood/@quochuy/making-turmeric-powder-and-starch-at-home)! 

>Last month, I harvested my orange turmeric from the backyard my wife was going to make some Turmeric starch but with the health issue, she had to postponed this until yesterday. In order to help with the process I recently bought a dehydrator to shorten the drying process.[[Read More]](https://steemit.com/growyourownfood/@quochuy/making-turmeric-powder-and-starch-at-home)

![IMG_8884.JPG](https://files.steempeak.com/file/steempeak/naturalmedicine/P5MDiCQW-IMG_8884.JPG)

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

# Growing Turmeric - Day 231 - Haiku - On the Benefits of Turmeric, and Growing Our Own Food and Medicine!

by @crescendoofpeace

Did you know you can grow turmeric in a pot? @crescendoofpeace shares her experience and provides advice on growing your very own magical, powerful natural medicine at home! [Learn how here](https://steemit.com/naturalmedicine/@crescendoofpeace/growing-turmeric-day-231-haiku-on-the-benefits-of-turmeric-and-growing-our-own-food-and-medicine)

> The night before last I finally harvested my turmeric from the large pot in which I've been growing it for the past season. This may surprise some who follow my blog, as I'm in Middle Tennessee, and we've already had several hard freezes, but I've always taken care to bring it inside before we reached freezing temperatures, so it did perfectly fine.! [[Read More]](https://steemit.com/naturalmedicine/@crescendoofpeace/growing-turmeric-day-231-haiku-on-the-benefits-of-turmeric-and-growing-our-own-food-and-medicine)

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

# <center>Even More Natural Medicine Goodness </center>

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)

@nateonsteemit motivates us with cool [Permaculture playing cards](https://steemit.com/permaculture/@nateonsteemit/permaculture-playing-cards-episode-1), a contest that will sharpen your permaculture knowledge while giving you the chance to win SBI shares. This is something you don't want to miss! 

@thetreeoflife shares an idea that would be perfect for gift giving with [Lavender Flower Sachets bring us Joy](https://steemit.com/naturalmedicine/@thetreeoflife/lavender-flower-sachets-bring-us-joy)!

@sagescrub shares some plant power with us by [teaching us all about the magnificent Queen Anne’s Lace – Daucus carota](https://steemit.com/naturalmedicine/@sagescrub/queen-anne-s-lace-seeds-for-abundant-medicine-food-and-beauty) also known as wild carrot. 

@immarojas presents us with [The Beauty and the Healing Properties of Narra or Red Sandalwood](https://steemit.com/photography/@immarojas/the-beauty-and-the-healing-properties-of-narra-or-red-sandalwood). Did you know that this tree offers medicinal benefits? 

![dividerbetweeneachcuration](https://files.steempeak.com/file/steempeak/naturalmedicine/BXzzkeli-download-1.png)
There's always something exciting going on over at @naturalmedicine. The [latest contest](https://steemit.com/naturalmedicine/@naturalmedicine/week-1-round-up-what-does-witch-mean-to-you-20-sbd-of-prizes-due-date-dec-21st) is still running strong. 

The challenge asks <b>'What does 'witch' mean to you?'</b>. The submissions have been nothing short of AWESOME!! Be sure to check them out, comment and give these inspired posts some love. 

There is 20 Steem worth of prizes to be won! [Entries accepted til Dec 21st](https://steemit.com/naturalmedicine/@naturalmedicine/week-1-round-up-what-does-witch-mean-to-you-20-sbd-of-prizes-due-date-dec-21st)! 

<center>
![image.png](https://files.steempeak.com/file/steempeak/naturalmedicine/KBJx5RTT-image.png)

![image.png](https://files.steempeak.com/file/steempeak/naturalmedicine/V1DZYiPa-image.png)
###### ***Please consider delegating to @naturalmedicine by clicking any amount below. The minimum entry for membership is 10SP, and helps support and celebrate your work with natural remedies, healings and nurturings on this gorgeous blockchain!***
[10SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=10%20SP)II[20SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=20%20SP)II[50SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=50%20SP)II[75SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=75%20SP)II[100SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=100%20SP)II[200](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=200%20SP)II[300SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=300%20SP)II[500SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=500%20SP)II[1000SP](https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=@naturalmedicine&vesting_shares=1000%20SP)
![heartlogo.fw.png](https://files.steempeak.com/file/steempeak/naturalmedicine/gkaVJUL8-heartlogo.fw.png)
</center>

Duplicate with #82 , it was fixed on the master.