MD notes not working in latest Zotero beta

Hi there,
I'm using running 5.0.97-beta.43+c5d89f6d05.0.97-beta.43+c5d89f6d05.0.97-beta.43+c5d89f6d0 and MDnotes is not working. The 'create full export note' and 'export to markdown' are not producing any outcome. Under tools>Mdnotes preferences clicking the 'choose' button for the export directory and template folder has no effect.
Thank you all for your hard work on the beta. It looks and feels great!
  • In general you should report issues with mdnotes to the developer, but they're aware of these issues.
  • edited September 11, 2021
    As a workaround you could use this set of commands:

    A simple way to export notes.
    I want achieve "atomicity" of my notes, so I need to split the text files which contain the individual notes dragged from Zotero in sections separated by lines of dashes.
    I then want to use the heading I gave to each note to name the new files i.e. rename with the first line of each section. I want to save these new files as markdown files.

    The script I have put together is made up of suggestions for each of these functions by contributors on the web.

    Ctrl-click to select each note. Drag into empty .txt file. Save in a new folder. I use this on the command line.

    Cut and paste the script into a separate .txt file. Replace "Notes_test.txt" with the name of your file. Save this with an appropriate name in a folder such as "Scripts" in your home directory. Copy script to clipboard. In terminal, navigate to new folder with the dragged notes .txt file. Use Terminal menu Edit>paste then Enter.


    An example of the input file would be the following in Notes_test.txt

    ```
    This is note 1

    It has some notes

    --------------------------------------------------

    This is note 2

    It has some more notes
    ```
    The output from this should be two files:
    ```
    This is note 1.md
    This is note 2.md
    ```


    This is the script I am using on the command line:
    ```
    csplit Notes_test.txt -f_ -z -b'%03d.md' /--------------------------------------------------/1 {*} && sed -i '/./,$!d' *.md && for f in *.md
    do
    f1=$(head -n1 "$f")
    mv -n "$f" "$f1.md"
    done
    ```
    and this is my understanding of the commands so far:

    -fPREFIX Use PREFIX as the output file name prefix. In this case an underscore is specified: "_" which I see is just a placeholder.

    -z Suppress the generation of zero-length output files. I think this is necessary because otherwise csplit will produce an empty file at the end of each run through splitting the original files.

    -bSuffix Use SUFFIX as the output file name suffix. In this case: "md"

    %03d puts a 3 digit number as a placeholder for the file name. I added the zero before the 3 at the suggestion of FelixJN (see link to unix.stackexchange below).

    /--------------------------------------------------/1 specifies the delimiter for the split, with the split being made 2 lines below the the line of "-"s (count starts from 0).

    {*} tells bash to run the split until the end of the file. As Felix points out, "{n}" is the number of splits to be executed. In this case "*" means do as many as possible.

    && means execute the following command on the condition that the previous command has completed

    sed -i directs sed to operate on files with a particular suffix
    '/./,$!d' means "remove blank lines at head of file" Thanks to Felix again for explaining that that this is to specify the range on which sed works: A "." means any character, so it specifies the first character that occurs in the document. Since empty lines do not have any characters, we will need to apply the negative "!" after defining the range. The range is defined by the pattern /"start"/,/"end"/ to apply the command between the strings "start" and "end". $ refers to the last line, so the range is all the non-empty lines in the document. To apply the negative use "!" meaning "NOT", i.e. tell sed to select the opposite of the previous range. In this case all lines before the first line with any character. "d" then deletes these lines.

    *.md means "which has any name with suffix .md"

    f1=$(head -n1 "$f") means: define f1 as the first line ("head" means "first line") of the file. This is done by using the variable signifier "$" to define "f1" which will be a placeholder (in the next line of the script) for the new file names (minus suffix). "head" is a bash command that normally outputs the first 10 lines of each file: head [OPTION]... [FILE]... The option -n1 specifies to output one line only. Here, instead of specifying a particular FILE, "$f" specifies "all files." The quote marks around "$f" are needed so that whitespace is ignored (otherwise $f uses whitespace as field separator and further splits the files - see reference link below).

    mv -n "$f" "$f1.md" means: rename each file as "f1.md"

    The bash command "mv" takes options and arguments: mv [OPTION]... [-T] SOURCE DEST i.e.: "Rename SOURCE to DEST." The -n option stands for --no-clobber "do not overwrite an existing file." I think this is just in case there are files (notes) that have the same first line.



    See https://www.tutorialspoint.com/unix_commands/csplit.htm and
    coreutils for unix-like operating stems at https://www.gnu.org/software/coreutils/manual/coreutils.pdf
    and https://www.howtoforge.com/linux-csplit-command/ Q2.How to split files using regular expressions?
    and https://unix.stackexchange.com/questions/131766/why-does-my-shell-script-choke-on-whitespace-or-other-special-characters
    https://unix.stackexchange.com/questions/68694/when-is-double-quoting-necessary
    https://unix.stackexchange.com/questions/667835/help-me-understand-a-script-that-uses-csplit-and-sed
  • By the way Mdnotes>Export to markdown just started working for me again on Linux.
  • edited November 2, 2021
    Hi,

    I am not able to export Highlights via MDNotes (am able to export annotations though), if created using Zotero's Native PDF Reader (NPR, henceforth)

    At the moment I am using the beta version: 5.0.97-beta.51+6206209ed on Linux.

    1. As per [https://forums.zotero.org/discussion/comment/388634/#Comment_388634] I must use the 'Send to Note' option for exporting highlights made via NPR.

    2. As per [https://forums.zotero.org/discussion/comment/390841#Comment_390841] NPR to Markdown feature will be available in the future.

    3. As per [https://forums.zotero.org/discussion/76727/zotfile-does-not-extract-highlights], until option#2 becomes available, I should be using an external reader like Foxit or Acorbat to create highlights and annotations, if I wish to avail the customizable export feature of MDNotes.

    @cjpoor must be using option#3.

    Is that correct? Or am I missing something?

    P.S: Please mention the 'Send to Note' feature on this page [https://www.zotero.org/support/pdf_reader_preview] - I did not notice it until I chanced upon the thread#1 listed above.
  • @kazzy Hi.

    Since the built-in pdf reader became available, I no longer use an external reader to annotate pdfs.

    I am using the built-in pdf reader (NPR) in Zotero 5.0.97-beta.51+6206209ed on Linux Mint.

    I typically highlight a passage then add the annotation to a note. This requires the creation of a new Item Note by clicking the "+" at the top of the Notes pane.
    The annotation can either be dragged directly from the pdf reader into the note or using "Add to note" from the three dot menu on the annotation in the annotation pane.

    After adding comments, tags, related items and notes, I then use Mdnotes to Export to markdown.

    I really only export to markdown as a backup of my notes. I typically use the "Add Note" button in LibreOffice writer to make use of my notes from Zotero.

    I also find that Zotero is fine for storing and searching my notes. The main feature that it lacks is outlining, but since LibreOffice writer has improved its outlining features considerably, that no longer matters.
  • The annotation can either be dragged directly from the pdf reader into the note or using "Add to note" from the three dot menu on the annotation in the annotation pane.
    (You can also right-click on the annotation in the PDF view itself and choose Add to Note from the context menu.)
  • @kazzy Once or twice I thought that Mdnotes was not working because I was looking for the note in the saved folder under the heading I had given it. However, Mdnotes prefixes the heading with the citation key to give, for example

    eisenschitzTownPlanning2008 - Planning tries to contain unrest.md
Sign In or Register to comment.