parent
							
								
									3674df48b8
								
							
						
					
					
						commit
						1ddd15afc6
					
				
					 7 changed files with 236 additions and 247 deletions
				
			
		
							
								
								
									
										2
									
								
								.github/workflows/deploy.yaml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/deploy.yaml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -12,7 +12,7 @@ jobs:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Build Link Index
 | 
					      - name: Build Link Index
 | 
				
			||||||
        uses: jackyzha0/hugo-obsidian@v2.10
 | 
					        uses: jackyzha0/hugo-obsidian@v2.11
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          index: true
 | 
					          index: true
 | 
				
			||||||
          input: content
 | 
					          input: content
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,6 @@ function initPopover(baseURL) {
 | 
				
			||||||
      const links = [...document.getElementsByClassName("internal-link")]
 | 
					      const links = [...document.getElementsByClassName("internal-link")]
 | 
				
			||||||
      links.forEach(li => {
 | 
					      links.forEach(li => {
 | 
				
			||||||
        const linkDest = content[li.dataset.src.replace(basePath, "")]
 | 
					        const linkDest = content[li.dataset.src.replace(basePath, "")]
 | 
				
			||||||
                // const linkDest = content[li.dataset.src]
 | 
					 | 
				
			||||||
        if (linkDest) {
 | 
					        if (linkDest) {
 | 
				
			||||||
          const popoverElement = `<div class="popover">
 | 
					          const popoverElement = `<div class="popover">
 | 
				
			||||||
    <h3>${linkDest.title}</h3>
 | 
					    <h3>${linkDest.title}</h3>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,26 +59,20 @@ const removeMarkdown = (
 | 
				
			||||||
// -----
 | 
					// -----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(async function() {
 | 
					(async function() {
 | 
				
			||||||
 | 
					  const encoder = str => str.toLowerCase().split(/([^a-z]|[^\x00-\x7F])+/)
 | 
				
			||||||
  const contentIndex = new FlexSearch.Document({
 | 
					  const contentIndex = new FlexSearch.Document({
 | 
				
			||||||
    cache: true,
 | 
					    cache: true,
 | 
				
			||||||
    charset: "latin:extra",
 | 
					    charset: "latin:extra",
 | 
				
			||||||
    optimize: true,
 | 
					    optimize: true,
 | 
				
			||||||
        worker: true,
 | 
					 | 
				
			||||||
        document: {
 | 
					 | 
				
			||||||
    index: [{
 | 
					    index: [{
 | 
				
			||||||
      field: "content",
 | 
					      field: "content",
 | 
				
			||||||
                tokenize: "strict",
 | 
					      tokenize: "reverse",
 | 
				
			||||||
                context: {
 | 
					      encode: encoder,
 | 
				
			||||||
                    resolution: 5,
 | 
					 | 
				
			||||||
                    depth: 3,
 | 
					 | 
				
			||||||
                    bidirectional: true
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                suggest: true,
 | 
					 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
      field: "title",
 | 
					      field: "title",
 | 
				
			||||||
      tokenize: "forward",
 | 
					      tokenize: "forward",
 | 
				
			||||||
 | 
					      encode: encoder,
 | 
				
			||||||
    }]
 | 
					    }]
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { content } = await fetchData
 | 
					  const { content } = await fetchData
 | 
				
			||||||
| 
						 | 
					@ -158,17 +152,16 @@ const removeMarkdown = (
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
  source.addEventListener('input', (e) => {
 | 
					  source.addEventListener('input', (e) => {
 | 
				
			||||||
    term = e.target.value
 | 
					    term = e.target.value
 | 
				
			||||||
        contentIndex.search(term, [
 | 
					    const searchResults = contentIndex.search(term, [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        field: "content",
 | 
					        field: "content",
 | 
				
			||||||
        limit: 10,
 | 
					        limit: 10,
 | 
				
			||||||
                suggest: true,
 | 
					 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        field: "title",
 | 
					        field: "title",
 | 
				
			||||||
        limit: 5,
 | 
					        limit: 5,
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
        ]).then(searchResults => {
 | 
					    ])
 | 
				
			||||||
    const getByField = field => {
 | 
					    const getByField = field => {
 | 
				
			||||||
      const results = searchResults.filter(x => x.field === field)
 | 
					      const results = searchResults.filter(x => x.field === field)
 | 
				
			||||||
      if (results.length === 0) {
 | 
					      if (results.length === 0) {
 | 
				
			||||||
| 
						 | 
					@ -199,7 +192,6 @@ const removeMarkdown = (
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const searchContainer = document.getElementById("search-container")
 | 
					  const searchContainer = document.getElementById("search-container")
 | 
				
			||||||
| 
						 | 
					@ -220,7 +212,7 @@ const removeMarkdown = (
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  document.addEventListener('keydown', (event) => {
 | 
					  document.addEventListener('keydown', (event) => {
 | 
				
			||||||
        if (event.key === "/") {
 | 
					    if (event.key === "k" && (event.ctrlKey || event.metaKey)) {
 | 
				
			||||||
      event.preventDefault()
 | 
					      event.preventDefault()
 | 
				
			||||||
      openSearch()
 | 
					      openSearch()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,4 +24,3 @@ If you prefer browsing the contents of this site through a list instead of a gra
 | 
				
			||||||
- 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md)
 | 
					- 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md)
 | 
				
			||||||
- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
 | 
					- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
 | 
				
			||||||
- 👀 [Discord Community](https://discord.gg/cRFFHYye7t)
 | 
					- 👀 [Discord Community](https://discord.gg/cRFFHYye7t)
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,8 +28,7 @@
 | 
				
			||||||
          {{ .TableOfContents }}
 | 
					          {{ .TableOfContents }}
 | 
				
			||||||
      </aside>
 | 
					      </aside>
 | 
				
			||||||
      {{end}}
 | 
					      {{end}}
 | 
				
			||||||
      {{.Content}}
 | 
					      {{.Content | safeHTML}}
 | 
				
			||||||
 | 
					 | 
				
			||||||
    </article>
 | 
					    </article>
 | 
				
			||||||
    {{partial "footer.html" .}}
 | 
					    {{partial "footer.html" .}}
 | 
				
			||||||
    {{partial "popover.html" .}}
 | 
					    {{partial "popover.html" .}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@
 | 
				
			||||||
            {{ .TableOfContents }}
 | 
					            {{ .TableOfContents }}
 | 
				
			||||||
        </aside>
 | 
					        </aside>
 | 
				
			||||||
        {{end}}
 | 
					        {{end}}
 | 
				
			||||||
        {{- .Content -}}
 | 
					        {{.Content | safeHTML}}
 | 
				
			||||||
    </article>
 | 
					    </article>
 | 
				
			||||||
    {{partial "footer.html" .}}
 | 
					    {{partial "footer.html" .}}
 | 
				
			||||||
    {{partial "popover.html" .}}
 | 
					    {{partial "popover.html" .}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue