') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Fix bug in search for dev guide by Tejas2805 · Pull Request #1108 · MarkBind/markbind · GitHub
Skip to content

Fix bug in search for dev guide - #1108

Closed
Tejas2805 wants to merge 13 commits into
MarkBind:masterfrom
Tejas2805:bug-in-search-for-dev-guide
Closed

Fix bug in search for dev guide#1108
Tejas2805 wants to merge 13 commits into
MarkBind:masterfrom
Tejas2805:bug-in-search-for-dev-guide

Conversation

@Tejas2805

@Tejas2805Tejas2805 commented Mar 9, 2020

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [x] Bug fix

Fixes#1107

What is the rationale for this request?
It becomes confusing to see the same results twice.

What changes did you make? (Give an overview)

Changed the navigation layout for developer guide and maintainer guide

Provide some example code that this change will affect:

<navigation><spanclass="lead">**Developer Guide**</span>
* [Maintainer Guide]({{baseUrl}}/devGuide/maintainerGuide.html)
</navigation>

Is there anything you'd like reviewers to focus on?
N.A.

Testing instructions:
Can check deployed

Proposed commit message: (wrap lines at 72 characters)

* 'master' of https://github.com/MarkBind/markbind:
Update tests
Allow using 'none' footer attribute in frontmatter (MarkBind#1002)
Support line numbers for code blocks (MarkBind#991)
2.11.0
Update test files due to changes in PR MarkBind#982
Update vue-strap version to v2.0.1-markbind.36
Make highlighting bold (MarkBind#1045)
Support markdown for header attr in dropdown (MarkBind#1029)
Add '_site' to the ignored folders in site.json (MarkBind#1046)
Use path.join instead of string interpolation (MarkBind#1052)
Implement box markdown header attributes parsing (MarkBind#1025)
Make the position of top navbar fixed (MarkBind#982)
Exclude *.md files from being copied over on build (MarkBind#1010)
# Conflicts:
#	docs/css/main.css
* 'master' of https://github.com/MarkBind/markbind:
2.12.0
Update outdated test files
Update vue-strap version to v2.0.1-markbind.37
Fix refactor to processDynamicResources (MarkBind#1092)
Implement lazy page building for markbind serve (MarkBind#1038)
Add warnings for conflicting/deprecated component attribs (MarkBind#1057)
Allow changing parameter properties (MarkBind#1075)
Custom timezone for built-in timestamp (MarkBind#1073)
Fix reload inconsistency when updating frontmatter (MarkBind#1068)
Implement an api to ignore content in certain tags (MarkBind#1047)
Enable AppVeyor CI (MarkBind#1040)
Add heading and line highlighting to code blocks (MarkBind#1034)
Add dividers and fix bug in siteNav (MarkBind#1063)
Fixed navbar no longer covers modals (MarkBind#1070)
Add copy code-block plugin (MarkBind#1043)
Render plugins on dynamic resources (MarkBind#1051)
Documentation for Implement no-* attributes for <box> (MarkBind#1042)
Migrate to bootstrap-vue popovers (MarkBind#1033)
Refactor preprocess and url processing functions (MarkBind#1026)
Add pageNav to Using Plugins Page (MarkBind#1062)
@Tejas2805
Tejas2805 marked this pull request as ready for review March 9, 2020 08:06
@ang-zeyu

Copy link
Copy Markdown
Contributor

Hmm the duplicate results still occurs, as index.md includes devGuide.md as a static include.

A simple fix for this would be to simply rename devGuide.md to index.md.

@damithc

Copy link
Copy Markdown
Contributor

Hmm the duplicate results still occurs, as index.md includes devGuide.md as a static include.

A simple fix for this would be to simply rename devGuide.md to index.md.

How about some kind of redirection mechanism? In CS2103, landing page content changes over time (e.g., before the semester starts vs during the semester). Currently, I use a static include to change the content easily.

@Tejas2805

Copy link
Copy Markdown
ContributorAuthor

A simple fix for this would be to simply rename devGuide.md to index.md.

Ah I see. Just noticed this when you said it.

  1. Remove the index.md file and refer it to devGuide.md
  2. If we wanna keep index.md, we just rename devGuide.md to index.md

@ang-zeyu

Copy link
Copy Markdown
Contributor

How about some kind of redirection mechanism? In CS2103, landing page content changes over time (e.g., before the semester starts vs during the semester). Currently, I use a static include to change the content easily.

  1. Remove the index.md file and refer it to devGuide.md
  2. If we wanna keep index.md, we just rename devGuide.md to index.md

Redirection sounds good; We might want to include a "landing page" for the developer guide different from devGuide.md somewhere in the future.

@Tejas2805

Copy link
Copy Markdown
ContributorAuthor

Not exactly sure what you mean by redirection. Can you guide a bit?

@ang-zeyu

Copy link
Copy Markdown
Contributor

Not exactly sure what you mean by redirection. Can you guide a bit?

Something like window.location.href = "..." should work!

@ang-zeyu

Copy link
Copy Markdown
Contributor

@Tejas2805 should we close this?

@Tejas2805

Copy link
Copy Markdown
ContributorAuthor

Have closed this

@Tejas2805Tejas2805 mentioned this pull request Mar 28, 2020
@Tejas2805
Tejas2805 deleted the bug-in-search-for-dev-guide branch April 11, 2020 14:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search shows duplicate for Developer Guide

3 participants

@Tejas2805@ang-zeyu@damithc