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

nested list indentation of 4 spaces causes <pre> blocks in hugo #344

Closed
sprajagopal opened this issue Apr 7, 2020 · 7 comments
Closed
Labels

Comments

@sprajagopal
Copy link

sprajagopal commented Apr 7, 2020

Actual Behavior

I am exporting my org files with ox-hugo. I opened an issue but it seems this behaviour as per markdown spec.
I went through ox-hugo.el and found reference to tabSizeEight which may solve this issue. But I am not sure how to enable this extension.

Expected Behavior

Nested lists should not have 4 space indent.

How to Reproduce the Issue

Export the following org file.

Example Org File

#+TITLE: hugo nested lists issue
#+SETUPFILE: hugo_setup.org
* Level 2
** Level 3
*** Level 4
**** Level 5
***** Level 6
****** Level 7
******* Level 8
******** Level 9
********* Level 10

Generated Markdown File or Error

+++
title = "hugo nested lists issue"
author = ["pp"]
lastmod = 2020-04-07T22:54:49+05:30
draft = false
+++

## Level 2 {#level-2}


### Level 3 {#level-3}


#### Level 4 {#level-4}


##### Level 5 {#level-5}


###### Level 6 {#level-6}

-    Level 7

    -    Level 8

        -    Level 9

            -    Level 10

Ox-Hugo Debug Information

Debug Info
@kaushalmodi
Copy link
Owner

kaushalmodi commented Apr 7, 2020

I can reproduce that on this commonmark dingus (somehow that link doesn't work for me on Firefox, but works on Chrome).

image

Can you play around with that can come up with a markdown format that acts as a workaround?


I went through ox-hugo.el and found reference to tabSpaceEight which may solve this issue.

I am not aware of tabSpaceEight (just grepped through the whole ox-hugo repo; didn't find anything. Can you provide a reference? If it's an extension, it would go in your hugo site's config.toml.

@kaushalmodi
Copy link
Owner

OK, look like it works if I remove those extra spaces from after the hyphen: demo

image

@kaushalmodi
Copy link
Owner

kaushalmodi commented Apr 7, 2020

Turns out that the extras spaces after the hyphens are coming from somewhere in ox.el. I'll need some time to figure that out. Nope.. need to fix org-blackfriday-item org-hugo-headline.

@kaushalmodi
Copy link
Owner

kaushalmodi commented Apr 7, 2020

@sprajagopal Can you confirm the fix?

I have added a test case for this: https://ox-hugo.scripter.co/test/posts/level-offset-default/

Thanks for reporting this!

kaushalmodi added a commit that referenced this issue Apr 8, 2020
This is to cover the corner case where the previous section could be
ending in a plain list, and we want the current
heading-turned-list-item to merge that that list.

This is possible is the current heading level is 6 or more, or if the
`h' Export Option is set to a lower value by the user.

Related: #344
@sprajagopal
Copy link
Author

Hello,
I updated and tried this now. The resulting markdown is as follows.

## Level 2 {#level-2}
### Level 3 {#level-3}
#### Level 4 {#level-4}
##### Level 5 {#level-5}
###### Level 6 {#level-6}

<!--list-separator-->

-  Level 7

    <!--list-separator-->

    -  Level 8

        <!--list-separator-->

        -  Level 9

            <!--list-separator-->

            -  Level 10

It renders correctly in html also with hugo.
Thanks a lot for a superfast fix!
( I expected someone would comment a workaround not that the actual issue would be fixed overnight :D)

@sprajagopal
Copy link
Author

I can reproduce that on this commonmark dingus (somehow that link doesn't work for me on Firefox, but works on Chrome).

image

Can you play around with that can come up with a markdown format that acts as a workaround?

I went through ox-hugo.el and found reference to tabSpaceEight which may solve this issue.

I am not aware of tabSpaceEight (just grepped through the whole ox-hugo repo; didn't find anything. Can you provide a reference? If it's an extension, it would go in your hugo site's config.toml.

Sorry I typoed. It was tabSizeEight in ox-hugo.el

(defvar org-hugo-blackfriday-extensions                                                                                                                                     
  '("noIntraEmphasis"                                                                                                                                                       
    "tables"                                                                                                                                                                
    "fencedCode"                                                                                                                                                            
    "autolink"                                                                                                                                                              
    "strikethrough"                                                                                                                                                         
    "laxHtmlBlocks"                                                                                                                                                         
    "spaceHeaders"                                                                                                                                                          
    "hardLineBreak"                                                                                                                                                         
    "tabSizeEight"                                                                                                                                                          
    "footnotes"                                                                                                                                                             
    "noEmptyLineBeforeBlock"                                                                                                                                                
    "headerIds"                                                                                                                                                             
    "titleblock"                                                                                                                                                            
    "autoHeaderIds"                                                                                                                                                         
    "backslashLineBreak"                                                                                                                                                    
    "definitionLists"                                                                                                                                                       
    "joinLines")   

@kaushalmodi
Copy link
Owner

It was tabSizeEight in ox-hugo.el

Ah right! It's been a while since I added that. Those are Blackfriday extensions, and will not work with Goldmark. Both are Markdown rendering libraries. Goldmark is a much better one as it is compliant with commonmark. Hugo switched to making Goldmark as the default library since Hugo 0.60.0. At some point, I will move out the dead Blackfriday code in this repo to a separate library in an archived state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants