Coder Social home page Coder Social logo

folding-markdown's People

Contributors

aerijo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

wlwl2

folding-markdown's Issues

Uncaught TypeError when folding with empty headers

To reproduce

  1. create a Markdown file with multiple top-level headers of the same level.
  2. leave the first header empty (any number of line breaks before the following header).
# First header

# Second header
- text below second header
  1. apply the Fold At Indent Level # command.
  2. if any header (other than the final one) is left empty, it causes an Uncaught TypeError.

It seems that the same error occurs for any level header (H2, H3, etc.) when it’s the top-level header in the file.


Also

If the final header in the file is empty, there’s no error — unless there are blank lines following that header.

No error

# First header
- text below first header

# Second header[EOF]

Error

# First header
- text below first header

# Second header
[blank line]
[EOF]

Atom: 1.58.0 x64
Electron: 9.4.4
OS: macOS 12.1
Thrown From: folding-markdown package 0.1.4

Uncaught TypeError: Cannot read property 'end' of undefined

Prerequisites

Description

Steps to Reproduce

Expected behavior:

Actual behavior:

Versions

Atom: 1.60.0 x64
Electron: 9.4.4
OS: macOS 12.5.1
Thrown From: folding-markdown package 0.1.4

Stack Trace

Uncaught TypeError: Cannot read property 'end' of undefined

At /Users/jiantang.li/.atom/packages/folding-markdown/lib/main.js:84

TypeError: Cannot read property 'end' of undefined
    at Object.getFoldableRangesAtHeaderLevel (/packages/folding-markdown/lib/main.js:84:21)
    at TextMateLanguageMode.languageMode.getFoldableRangesAtIndentLevel (/packages/atom-folding/dist/main.js:51:48)
    at TextEditor.foldAllAtIndentLevel (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:50681)
    at TextEditor.editor:fold-at-indent-level-2 (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:306854)
    at HTMLElement.n.<computed> (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:309471)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:352694)
    at KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1228469)
    at KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1224603)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:286682)

Commands

     -1:04.8.0 core:close (input.hidden-input)
     -1:04.3.0 fuzzy-finder:toggle-file-finder (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
     -1:02.2.0 core:backspace (input.hidden-input)
  2x -1:02.1.0 editor:delete-to-beginning-of-line (input.hidden-input)
     -1:00.8.0 core:confirm (input.hidden-input)
     -0:04.1.0 editor:fold-at-indent-level-2 (input.hidden-input)

Non-Core Packages

atom-folding 0.0.9 
folding-markdown 0.1.4 
language-markdown 0.37.0 
markdown-preview-plus 4.11.1 
markdown-writer 2.11.11 

Additional Information

Fenced code blocks

Great tool, thanks! You might put in a screenshot or something to let others know about this, as it works nicely with no need for key commands.

Might you be able to also add support collapsing fenced coding blocks like:

```js

```

?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.