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

# inside <Code> #284

Closed
CalebCDE opened this issue Feb 5, 2024 · 3 comments
Closed

# inside <Code> #284

CalebCDE opened this issue Feb 5, 2024 · 3 comments
Assignees
Labels
Behavior follows specs It looks wrong, but that's how it's supposed to work

Comments

@CalebCDE
Copy link

CalebCDE commented Feb 5, 2024

Hi.

I have this issue when convert to html

If i have a block (bash) with comments (#EOF in my case)

It convert EOF to a title :)

@Orc
Copy link
Owner

Orc commented Feb 5, 2024

Can you show me a sample that causes discount to fail?

@CalebCDE
Copy link
Author

CalebCDE commented Feb 6, 2024

Hi. Sure :-)

#!bin/bash
data=$(BeInput "Insert your name")
echo "Your name is" $data
#EOF

is the code

#!bin/bash data=$(BeInput “Insert your name”) echo “Your name is” $data

EOF

is the output

Uploaded a .txt file with plain text with the code and the output :-)
https://0x0.st/Hk6U.txt

@Orc
Copy link
Owner

Orc commented Feb 6, 2024

Alas, that's the output that's supposed to happen according to standard (John Gruber's) markdown. If you put that code into the markdown dingus that's what you'll see. What's happening is the parser is breaking the code into two paragraphs:

<code>#!bin/bash
data=$(BeInput "Insert your name")
echo "Your name is" $data

and

#EOF</code>

and then it doesn't process either as paragraphs containing code sections.

This is a behavior I cannot change while keeping discount markdown compatable, sorry :-(

Have you considered using either fenced code (if you're calling discount as a library, set the MKD_FENCEDCODE flag, and if you're using the markdown sample program giving it the argument -ffencedcode) or the traditional method of doing tab indentation?

(fenced code):

~~~~
#!bin/bash
data=$(BeInput "Insert your name")
echo "Your name is" $data
#EOF
~~~~

(tab indentation -- the <tab> markings signify either 4 space indent or a tab character)

<tab>#!bin/bash
<tab>data=$(BeInput "Insert your name")
<tab>echo "Your name is" $data
<tab>#EOF

(a fast shortcut would be to merely escape the # -- instead of typing #EOF, do \#EOF -- but it's just easier to wrap everything in a codeblock instead of needing to remember to do back and escape all the weird characters on column 0)

@Orc Orc closed this as completed Feb 6, 2024
@Orc Orc self-assigned this Feb 6, 2024
@Orc Orc added the Behavior follows specs It looks wrong, but that's how it's supposed to work label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Behavior follows specs It looks wrong, but that's how it's supposed to work
Projects
None yet
Development

No branches or pull requests

2 participants