Mind mapping: from Xmind to docsify blog

Today, I finally finished the exam that should have been finished a year ago. Tomorrow, I'm ready to start the lying down life (FOG) of my senior. Reviewing genetic engineering again is rewarding. In addition to professional progress, I also found this cold knowledge.

Tossing results: Click to view

Steps:

  • Configure your blog
  • Export xmind to markdown on iPad
  • Process with written program
  • Stick to markdown

First step

Tool GitHub address demo

Just follow the official website and insert the required code into your index The corresponding location of the HTML. (the following is the same as the official website)

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
  </head>
  <body>
    <!-- markmap is based on d3, so must load those files first. -->
    <script src="//unpkg.com/d3@3/d3.min.js"></script>
    <script src="//unpkg.com/markmap@0.6.1/lib/d3-flextree.js"></script>
    <script src="//unpkg.com/markmap@0.6.1/lib/view.mindmap.js"></script>
    <link rel="stylesheet" href="//unpkg.com/markmap@0.6.1/style/view.mindmap.css">

    <div id="app"></div>
    <script>
      window.$docsify = {
        mindmap: {
          // https://github.com/dundalek/markmap
          markmap: {
            preset: 'colorful', // or default
            linkShape: 'diagonal' // or bracket
          }
        }
      }
    </script>
    <script src="//unpkg.com/docsify@4/lib/docsify.min.js"></script>
    <script src="//unpkg.com/docsify-mindmap/dist/docsify-mindmap.min.js"></script>
  </body>
</html>
# Plain text

Step two

Open a markdown file and write:

```mindmap
root
  topic1
    subtopic
  topic2
    subtopic
```

It will present the mind map structure (what does it look like or see for yourself Official website (bar)

Wait a minute, do you think this structure is very similar to markdown?

Xmind can be converted to json, but the conversion is too complex. You must wrap the dictionary string reasonably..

Step 3

Export your mind map from Xmind as markdown. I can do it on the iPad when I try, but I charge money on the computer

It looks like this:

## Chp 3 Obtaining Target Genes
### From genomic/plasmid DNA
#### Genome: isolation
##### Grinding + cracking liquid
###### Adsorption column + rinsing elution
###### Phenol + chloroform, alcohol precipitation
#### Plasmid: alkaline isolation
##### Resuspension
###### Glucose, RNase, EDTA
##### Lysis
###### NaOH, SDS
##### Neutralization
###### High salt HAc buffer
###### Plasmid renaturation
### From genomic/cDNA library
#### Library
##### Into fragments, into vectors, into host
##### Complete, stable
###### capacity*clone number
#### Genome
(gDNA)
##### 
##### Steps
###### Extract genomic DNA
###### Partially digestion
* Choose enzyme and time
* Pick fragments whose length fit the vector
###### Insert into vector and transform
###### Screening
* With nucleic acid probes/antibody
(Replicate to NC membrane)
* With resistance gene
##### gDNA lib
Signigicance
###### Stable storage
###### Enrichment and amplification
###### Genome profiling and find unknown genes
#### cDNA
##### Steps
###### Extract mRNA
* Affinity chromatography: oligo-dT(poly a tail) cellulose
###### Synthesis of cDNA
* template chain
    * Oligo dT primer
    * Random primer
    * Gene specific primer
* 2nd strand
    * method1
        * remove RNA
            * RNase H
        * coding chain
            * 3' folds back as primer
            * S1 nuclease cut hairpin
    * method2
        * No removal
        * Gene specific reverse primer
        * Or add poly C
        oligo-dG as primer

Step 4

Observe the characteristics of the code and write the program to convert it into the required format.

Strategy: the designer should take the empty two as a tab. We replace the text and replace one # with two spaces. It's actually very simple

This example includes all the problems needing attention:

  • There is no indentation in chapter, so two should be deleted from each line#
  • After all # are completed, there is a space, which shall be deleted together
  • *Is a seven level title, which is replaced with seven before processing#
  • Use the four space indent below the seven level title, so replace the four spaces with one#
  • In some places, I use forced line feed and need to return the previous line

So the Python code is as follows:

def parse_md(path):
    # read file
    with open(path + '.md', 'r', encoding='utf-8') as f:
        lines = f.readlines()
    # process, to be consistent
    for i in range(len(lines)):
        if '*' in lines[i]:
            lines[i] = lines[i].replace('*', '#######')  # *It's a seven level title
        if '    ' in lines[i]:
            lines[i] = lines[i].replace('    ', '#')  # Suppose there are no more such four spaces
        if lines[i][0] != '#' and lines[i][0] != '*':  # Processing forced line breaks
            lines[i-1] = lines[i-1].strip('\n') + ' ' + lines[i]  # Remove the newline from the previous line and spell this line
            lines[i] = ''  # Clear this line
    # transformation
    with open(path + '.txt', 'w') as f:
        for line in lines:
            l = line.replace('## ', '').replace('�', '')
            # If it is separated by chapter, delete two#, adjust as needed; And delete possible garbled code
            f.write(l.replace('#', '  '))  # Two spaces


path = 'test'  # Don't add it md
parse_md(path)

For example, after the above example is converted

Chp 3 Obtaining Target Genes
  From genomic/plasmid DNA
    Genome: isolation
      grind+Pyrolysis fluid
        Adsorption column+Rinsing elution
        phenol+Chloroform, alcohol precipitation
    Plasmid: alkaline isolation
      Resuspension
        Glucose, RNase, EDTA
      Lysis
        NaOH, SDS
      Neutralization
        High salt HAc buffer
        Plasmid renaturation
  From genomic/cDNA library
    Library
      Into fragments, into vectors, into host
      Complete, stable
        capacity              clone number
    Genome (gDNA)
      
      Steps
        Extract genomic DNA
        Partially digestion
          Choose enzyme and time
          Pick fragments whose length fit the vector
        Insert into vector and transform
        Screening
          With nucleic acid probes/antibody (Replicate to NC membrane)
          With resistance gene
      gDNA lib Signigicance
        Stable storage
        Enrichment and amplification
        Genome profiling and find unknown genes
    cDNA
      Steps
        Extract mRNA
          Affinity chromatography: oligo-dT(poly a tail) cellulose
        Synthesis of cDNA
          template chain
            Oligo dT primer
            Random primer
            Gene specific primer
          2nd strand
            method1
              remove RNA
                RNase H
              coding chain
                3' folds back as primer
                S1 nuclease cut hairpin
            method2
              No removal
              Gene specific reverse primer
              Or add poly C
    oligo-dG as primer

The results are saved in the same name txt file, copy it to your document, the code type is mindmap, and you can see it after deployment.

In addition, we also found some features of this plug-in

  • The opening space doesn't matter and will be omitted
  • Chinese is still supported
  • Only the simplest mind mapping structure is supported, and beautification is also general..

I'll arrange other courses later!

Keywords: Front-end

Added by Mehdi on Fri, 25 Feb 2022 16:23:53 +0200